What are Variables in SAP Build Apps?
In the previous blog, we established that a Business user will need to understand some fundamentals of programming in order to become an effective Citizen Developer with SAP Build Apps. In this blog post, I will explain the first of these fundamentals: Variables.
In the realm of Object-Oriented Programming, variables play a critical role. So, what is a variable?
Simply put, a variable is a value that can change depending on the conditions and information passed to the program. Variables can either be static (a fixed value that cannot change) or dynamic (can continuously change to maintain its integrity).
Within Build Apps, there are 5 main variables which you can make use of to store and access dynamic data:
- App Variables: these exist globally. This means that when you create an App Variable you will be able to access the data that is hold on any page of the application.
Let’s think about it this way: when you log in to an application, how does this application remember that you are the user that is logged on? App Variables!
When you log on the App Variable associated with maintaining the logged in user is set to your credentials and remains this way throughout your usage with the application.
- Page Variables: these exist only on the page for which they are created. This means that you will not be able to access this data on any other page within the application.
But let’s color this explanation with an example: when you filter through a list in an application, these filters are not available in entire application. But, only on the current page. These filters exist and are set only within this page, once you leave the page variables which hold the filter data no longer exist.
- Page Parameters: these are read-only text variables that can be passed from one page to another. This means that the value cannot be changed and they have to be structured as text.
To illustrate this in action, imagine that you are viewing a list within an application and select an item within the list that redirects you to a page with information about that item. The text which you clicked on to access the item page is a page parameter.
- Data Variables: similarly, to App Variables, Data variables exist globally. However, they have a completely different schema. Data Variables have to be linked to some form of backend data or database. The data variable will take on a specific value which in pulls from the data source and hold this data for use throughout the application.
Let’s build on our login example: usually, user information is not stored in the application itself. Rather it is stored in a backend database. In order to leverage the data from the database, we can retrieve your information from this database and store it within a data variable to use throughout the application.
- Translation Variables: these allow you to translate text from one language to another.
Variables play a critical role in enabling functionality and holding data within your application. Now that you have understanding of what they are and how they work, we will start to understand how to create variables and give them meaning in SAP Build Apps in the next blog post.
Be sure to share your thoughts and feedback in the comments.