Welcome, Guest Login

Support Center

Replacing a feed name by a variable.

Last Updated: Sep 13, 2016 05:29PM EDT
Using a Variable for a Feed

Introduction
This is a technique to use multiple data sources (feeds) within a single statement.
This is more for the advanced user.


Use Case
To reduce your number of specific views you might want to use the same view to display different feeds. Instead of copying your views multiple times, it's more efficient to use the same view and use variable(s) to display multiple feeds in that view.


Say you have four feeds: 
  • [[ds:/FEED 1/entry/title]]
  • [[ds:/FEED 2/entry/title]]
  • [[ds:/FEED 3/entry/title]]
  • [[ds:/FEED 4/entry/title]]

You can state this as 
  • [[dsv:/MYFEED/entry/title]]

MYFEED will be a variable name. This can be any variable name you set up. This allows for multiple data source to be used in one expression by using a variable in the data source expression and DSV instead of DS in the statement.

Example

Lets say there are separate data sources for each state and the data structure for each state is the same except for the state name:
  • [[ds:/alabama/entry/title]]
  • [[ds:/alaska/entry/title]]
  • [[ds:/arizona/entry/title]]
  • [[ds:/arkansas/entry/title]]  etc, etc

In the app there is a list of all the states. Let's say the user taps on Arizona in the list. When they tap on Arizona we set a variable for that state using the action "Set a Variable". This sets the value for "state" on whatever value you assign to it.
 

This will set the Variable "state" with the value of "Arizona".

Whenever you point to one of the state data sources in the App Studio it will first look something like this: [[ds:/arizona/entry/title]]

In the Block we edit the value to look like this:
 [[dsv:/state/entry/title]]

So
  • "ds" is changed to "dsv" and
  • "arizona" was changed to "state"
Now any value assigned to the variable "state" will pull in the right data source for that value.

BEFORE

 

AFTER
 
Now any state the user taps on will use the right state data source from many to pull the data into the app. 













 

Help us improve! Rate this article:

Yes I found this article helpful

Ask a Question   

support@eachscape.com
http://assets0.desk.com/
false
eachscape
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete