Every time we are on an App screen and we click on a button / element to produce a specific action, a button with the text: COMPOSITOR will be displayed.
The compositor is shown every time we use specific actions such as the following displayed in the image below:
Now let's see what a composer is and how to use it:
COMPOSITOR IN A DATA VIEW:
If we are in a Data View screen and we want to use one of the actions listed above, we can use the compositor to define the target of an action.
Let’s see an example of how to use it:
1. First we will create a Database in a Data View screen.
In this database we will insert 6 columns with some information that we want to show in our app.
2. Now we are going to create 2 views (one type "List" and another type "Detail" to see the details of each item in the list of elements we want to show).
3. Imagine having a list of cities to create a tourist guide.
In the first view, the LIST one, we will insert the list of cities we want to display so that the user can choose, later, the details they want to see for each city.
Then we assign to the [cities] element (which refers to the text field of the database) the action: go to view: detail_1, so that, when clicking the button, a view with the details of each city will open.
4. In the DETAIL view we will insert the elements (details) of the cities and we will drag in the view of the dynamic elements with the pink color: Images, Cities and some static elements (icons) to execute some actions.
5. Now let's assign each icon with an action that requires the use of the compositor:
A) Web Icon: We want that, when clicking on this icon, the user can see some related websites which contain, for example, a city guide.
To allow the icon to open the URLs that we have in our database (in the field [URLweb]), we have to assign the action: Open url and following this action we will open the compositor.
The composer contains all the fields from all the databases created in the app. So we can choose (directly from the compositor) the field of a database we want to show, share, open, call etc, simply by selecting it from the compositor.
In our example, when clicking on the compositor a list of fields will appear:
Note: This app contains several databases, although we are showing only one (which is named "Base de Datos").
We can see that in the compositor list we have a field in brackets like this: (Base de Datos.URL web)
Base de Datos -> is the name of the database we are using. (If we want to display a field from another database already created, we will have to choose another name)
URL web -> is the name of the field we want to show (i.e. the field / column of the database containing the web urls).
In this example we tell the button to open the URL contained in this field, relating to the city of which we are viewing the details.
B) Location Icon: In this example we want, by clicking the second icon, a map to show the route from our current position to the point of interest which exists in the database.
Then we are going to assign the action: Route to the icon and, following that, just click on the compositor.
In the list of the compositor we have a field in brackets like this:
(Base de Datos.Localización)
Base de Datos -> as explained before, it is the name of the database we are using.
Localización -> is the name of the field containing the coordinates from the database that we want to show.
In this example we tell the button to show us the route from our position to the point of interest (coordinates of a city from the database).
C) Telephone Icon: In this example we want the user to be able to call a phone number that is already inserted in our database when clicking on the third icon.
Then we assign the icon to the action: Call and, following that, we will click on the compositor.
In the list of the compositor we have a field in brackets like this:
(Base de Datos.Telephone)
Base de Datos -> name of the database we are using.
Telephone -> is the name of the field containing the phone numbers from our database.
D) Audio Icon: In this example we want to be able to play audio in mp3 format (that is in the database) of a tourist guide by using the PLAY action. We want to do this when clicking on the fourth icon.
Then we will assign the icon the action: Play and, following that, we will click on the compositor.
In the list of the compositor we have a field in brackets like this:
(Base de Datos.Audio)
Base de Datos -> the name of the database we are using.
Audio -> is the name of the field, in audio format, which contains audio files from our database.
E) Share Icon: In this example we want to be able to share a web URL from the database by using the SHARE action. We want to do this when clicking on the fifth icon.
Then we will assign the icon the action: Share and, following that, we will click on the compositor.
In the list of the compositor we have a field in brackets like this:
(Base de Datos.URLweb)
Base de Datos -> the name of the database we are using.
URLweb -> is the field name in text format, which contains the url web from our database.
NOTE: as explained before, if we have more Databases, the composer will display all the fields of each database and we can use them, although we are in another data view with a different database (relational databases).
VARIABLES
Another new functionality available are the variables that can be found directly within the compositor of a Data View.
If we move down the list of elements of the Compositor, we will see a list of global variables which allow the developer to customize and analyze the activity of its users.
To see the list of variables that you can use, just click here
COMPOSITOR IN A DETAIL SCREEN
Everything mentioned above can also be applied to a Detail screen.
Now we can use/call a database field also in other screens which are not a data view type.
Let's see an example:
We have created in the following example a DETAIL screen with a menu bar below and a text element in the center.
If we want this element text becomes a button to perform an action connected to a field of the database, we only must assign the action we want to execute and choose from the compositor the field of the database we want to call.
In this example we want that, when clicking on the button/text, the user can share a picture from a database that we have already created.
Then we assign the text the action: Share and as destination we will click on the compositor.
In the list of compositor brackets we have a field in brackets like this:
(Base de Datos.Images)
Base de Datos -> the name of the database we are using.
If, for example, we have a second database named "Cities", we will have also this field in the compositor: (Cities.Images).
Images -> is the field name, in local image format, which contains the pictures from our database.
Note: We can do the same with other actions, by calling other fields from the databases created.
SET Y REQUEST ACTIONS
A Mobincube news, for the exclusive use of advanced developers, are the SET and REQUEST actions.
The SET action is used to assign values to variables.
SET can be var. or cookie.
If var. -> The value of the variable is deleted when we close the app.
If cookie. -> the value of the variable will be saved even if the app is closed.
Note: The value will be not saved if we will uninstall the app on the device.
SET examples:
SET {var.name}=oscar
SET {cookie.name}=oscar
With Database:
SET (Column1)=25
SET (Column1)={var.age}
*Do not insert spaces before or after the = symbol
The REQUEST action is used to receive and send data to a server
An example of REQUEST to insert in the destination of the action will be the following:
-- "url":"http://www.mobimento.com/~rquin/request.txt"
It has to contain a URL or a valid file.
-- "params":[{"paramKey":"paramDeviceInfo","paramValue":"{deviceInfo}"
It indicates the parameters and values that will be SENT to the server
-- "resultMessageVariable":"var.requestResultMessage","resultCodeVariable":"var.requestResultCode"
Saves the messages displayed by the server when using the request in the app variables.
COMPOSITOR IN DYNAMIC FILTERS
To see how the composer works on the dynamic filters, see the related article: Dynamic filters and relational databases