All Collections
Basics
Dynamic Variables
Dynamic Variables
Patrick avatar
Written by Patrick
Updated over a week ago

Dynamic variables play a pivotal role in the seamless functioning of various systems, intertwining with functions that dictate Create Edit Delete Permissions, Hidden Filters and Run and Display Conditions. These variables serve as dynamic placeholders, allowing for real-time adjustments and customization within all applications and software environments.

Jump to our guides to read more about each of the Frontly functions below:

Create, Edit, Delete Permissions
Hidden Filters
Display Conditions

Understanding the concept of dynamic variables in Frontly is important, as it forms the backbone of a flexible and adaptive system in your app and enables a responsive and tailored experience for your users.


Understanding Static vs Dynamic

Static text remains fixed and does not change. For instance, a Block label in your app that says 'Projects', which will be the same for all users.

Dynamic means that something changes based on other factors. For example, you have a Text block welcoming the user to the app, like "Hi, John Smith".

In this case, "Hi," would static, but "John Smith" is dynamic, based on the user who is currently logged in. In Frontly, you can easily inject dynamic variables in any text field to add dynamic values to your app text and your more advanced functions. Variables like this exist in other software such as email programs, so it's not just exclusive to Frontly!

The Hi, John Smith text may be represented as dynamic variables in one of two ways:

OR

Hi, {{user.first_Name}} {{user.last_name}}

The syntax of {{ DATA SOURCE NAME . FIELD NAME }} is using an older notation system, but is identical in function to the newer display.


Injecting Dynamic Variables

In text fields that supports dynamic variables, you'll see a 'plus' button on the right side:

Clicking this field will pop up a Data Sources menu showing valid data sources:


Select a data source from the variable selector:


Once you select a data source, all the valid fields will appear:

Once you select a field, you'll see the variable injected right into the text field like this:

Click here to see the full list of Variable Types at Frontly.

Click here to learn about how to trigger a value to create Incrementing and Decrementing Values.


Setting Default Values

All dynamic variables in Frontly support the following syntax for adding a 'default' or fallback value in case the variable is empty.

{{ user.Status || Pending }}

Notice the two bars || and the 'Pending' value which is the default I've set.

This way, if my user does not have a Status set in my data, it will display as Pending.

You can use any static value as the default value, such as a number:

{{ user.Age || 12 }}

Did this answer your question?