Developing expressions in Elipse Mobile.

Question:

How can I develop expressions in Elipse Mobile?

Solution:

You can change a few of the control’s properties according to tag value. To insert an expression, the first expression in the field must be “=”,  which indicates the field is receiving an expression.

Example:

Let’s create a Display control, whose Title should change according to water temperature. In this case, water sensor is in demo:TagInternal1; when water is below 20°C, its title should be “Cold Water”, and when it’s above this temperature, it should be “Hot Water”. The following expression will be inserted in the field:

=ValueOf(“demo:TagInternal1”) <= 20?"Cold Water":"Hot Water"

In addition to its title, the control’s color should also be changed according to tag value: when water is below 20°C, the control should be displayed in blue; above 20°C, red. To do so, insert the following expression in Color field:

=ValueOf(“demo:TagInternal1”) <= 20?"#144E9F":"#C01F2A"

Results:

NOTE: The logical operators used in this case are the same ones used in javascript.

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *