How to change the text by a value


I have made an app variable that shows the rank of the user (Guest, Member, Admin). I tried using an if condition to change the text depending on that value. For example, if you are a guest, instead of welcoming you, it would recommend you login/sign up. But I can’t use those if conditions on app variables. The text and the login form are both on different pages. How can I do it? Thanks!

Maybe something like this:

IF(appVars.rank=="Admin", "Let's do the admin-stuff", 
IF(appVars.rank=="Member", "Hello there dear Member", 
IF(appVars.rank=="Guest", "Great to have You here, please Sign up!", 
"placeholder for anybody who doesn't have rank")))
1 Like

Where do I put this code? I have never placed a code while building on this app.

It is just the regular use of the Formulas in the set page variable flow or even the value property of the specific text component.

So to demonstrate:

Here is the working solution:

But please do the tutorial and read a little bit more on the
And as the last suggestion use the small “i” icons next to the properties as those can help A LOT.


You can also add an app variable messages of type object. Each property name can be the rank, each text value can be the message you will show. Then your formula will be:

LOOKUP(appVars.messages, appVars.rank)


Indeed, for any more complex messages this should be the solution to use.
In this case a good suggestion is to add the value of the object “initial”-ly. Add that in the bottom of the properties section of Composer.

1 Like