- 10 Jan 2023
- 2 Minutes to read
- Contributors
- Print
- DarkLight
- PDF
Settings Page UI and App Variables
- Updated on 10 Jan 2023
- 2 Minutes to read
- Contributors
- Print
- DarkLight
- PDF
The Settings page is used to set user preference for Plant and Sloc variables. The End-User will be re-directed to this page when the App is newly installed or for every App re-install.
The End-User can do the following actions in the Settings page:
- Set Plant and Sloc preference when logged in for the first time.
- Change preference anytime by visiting this page
- Delete the preference values by clicking ‘Clear’ button
The following image shows the UI design in Settings page:
Similar to the Home page, since the Settings page receives input from the user, the variables used in this page are primitive datatypes. These variables are mapped to the Data property of the input fields used.
Functionality (Receive Inputs) | Component | Data Property (App variables) | Data Type |
---|---|---|---|
Plant | Select | settings_plant | String |
Sloc | Select | settings_sloc | String |
Save Preferences | Button | -NA- | |
Clear field data | Button | -NA- |
Table 4-1: App variables in Settings page
As discussed in the Home page section, since primitive data type variables do not persist beyond a session, the settings values received in Settings page are added to a table variable to retain the user preference for all sessions in the device. Therefore, the following additional app variable is used. Since Primary Key is mandatory in Offline app and neither Plant nor Sloc can be used as Primary Key, an additional column ‘ID’ is introduced.
Source data | App variables | Data Type |
---|---|---|
settings_plant | Settings.Plant | String |
settings_sloc | Settings.Sloc | String |
‘Default’ (Hard-coded to ensure there is always only one active preference) | Settings.ID | String |
Table 4-2: Additional app variables in Settings page
Settings Page Scripts
The first landing page on a newly installed App is the Settings page. The following scripts are added in the Settings page. To learn how to write scripts in EdgeReady platform, refer App Behavior section.
Settings -> onPageShow event
If length of Settings variable > 0, copy preference to settings_Plant and settings_Sloc. Refer screenshot below:
Settings -> select_plant -> change event
On every change of Plant, the filtered Sloc master table is set to reset. This helps in filtering of Sloc value based on current selection of Plant value. This action requires having an additional master copy of the Sloc Master.
Source Data (EdgeReady Database) | App variables | Data Type |
---|---|---|
PI_PLANTS | SlocMaster_copy.PLANT_NAME | String (Primary Key) |
PI_PLANTS | SlocMaster_copy.STORAGE_LOCATION | String |
Table 4-3: Additional variables in Home page
Refer screenshot below:
SlocMaster_copy is populated in the Initial Download.
Settings -> button_save_settings -> Click event
The Inlist insert at block inserts/updates a record based on the Primary Key value. This block inserts a record if there is no Primary Key match and updates the record if there is a Primary Key match. Since only one preference should be maintained for each device, the Primary Key value of Settings are hardcoded. Therefore, the Settings table will always have one entry. Refer screenshot below:
Settings -> button_clear -> Click event
Empty the field values. Refer screenshot below: