База знаний

Saving Entry Values For Reuse / Defaulting (Global Values)

Sometimes you may want to store values on the device to reuse on the same Screen or in multiple Screens.

 

For example, say you have a common field in several Form Screens that the user has to select every time - e.g. a project, client, or job number.

If the user tends to select the same value every time, then you should consider storing this in a Global Value.

 

Global Values let you specify that a Form field should get its default value from a new key/value store that exists on the device.

The functionality works as the name says - it's a globally accessible storage across all Screens on a specific device.

 

For now, only the Form screens can leverage this, but we will be introducing Global Values to other screen types soon.

 

Let's consider an example:

 

Say you have a screen that has a Project field and a Site field.

The Project must be chosen first from the list of available projects, and this then will filter the Site field with the available sites for that project.

 

1. On your Project field, set the "Bind to Global Value" property to be a name of your choice - e.g. "defaultProject".

 

2. On your Site field, set the "Bind to Global Value" property to be a different name of your choice - e.g. "defaultSite".

 

3. Save and set the Form into Test or Published mode.

 

When an entry for this Form is uploaded, the app will now automatically save the answer for Project into the Global Values key of "defaultProject", and similarly it will do the same for "defaultSite".

The app has effectively created a local dictionary/lookup that looks like:

 

defaultProject = "Last project the user selected"

defaultSite = "Last site the user selected"

 

When the user next opens your Form, these Global Values will be loaded and defaulted into the respective Project and Site fields - thus effectively remembering the last selected values for those two fields.

 

Similarly, you could now also set Project & Site fields in other Forms to bind to the defaultProject & defaultSite Global Values.

The same behaviour as above will occur when the user opens these Forms - they will see that Project and Site is preset.

This is powerful for cases where you want to have a persistent Project & Site context for the user across multiple Forms.

 

 

Using Global Values in a Formula

 

If you want to refer to a Global Value in a formula, this is also possible - simply use the GLOBALVAL('keyname') formula function.

 

Note that all Global Values are stored as text, so if you use GLOBALVAL() as an assignment to a Date/Time or Number field, then you will need to convert the value to the correct datatype of the target field. This is done using our TODATE() and TONUMBER() functions respectively.

 

 

 

 

  • 0 Пользователи нашли это полезным
Помог ли вам данный ответ?

Связанные статьи

Designing Forms

After creating a new Form Screen, you will be taken to the Form Design screen.   Every Form must...

Allowing Users to Jump Pages (Custom Form Navigation)

By default, every Form you create has automatic navigation buttons in the form of arrows that...

Dynamic Titles and Hints

Sometimes you may want your field's Title or Hint text to dynamically include a value from a...

Dynamically Displaying Images from Data Source, Web or Map sources

The "Dynamic Image" property allows you to load images dynamically into Media, Sketch and...

Formula Quick Question/Answer Reference

Below is a list of common scenarios that involve the use of a formula to achieve. This is purely...