Home Page UI and App Variables
  • 10 Jan 2023
  • 4 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Home Page UI and App Variables

  • Dark
    Light
  • PDF

Article summary

The Home page is used to receive inputs from user and store them in device in the form of records. In this use-case, each record is called a Log.

The End-User can perform the following actions in the Home page:

  • Select a Date from Calendar layout
  • Select a Plant from a dropdown list
  • Select a Sloc from a dropdown list
  • Scan a barcode or type a barcode and click Enter. This action will automatically store the data in the device.
  • View the total number of records added in the active batch
  • View the barcode of the last added record

The UI in the Home page with the above input fields for each record is designed as shown in the screenshot below:

3 Page 1_4 Home page in App Designer of EdgeReady PlatformI-4:Home page in App Designer of EdgeReady Platform image

The developer must always define App variables based on the UI layout of the app. For instance, in this Offline App, the Home page receives the input from End-user, validates it and insert them as one record. Therefore all variables used in the Home page are primitive datatypes. These variables are mapped to the Data property of the input fields used in this Home page.

Functionality (Receive Inputs)ComponentData Property (App variables)Data Type
Date

Text Input(Type: Date)

selected_dateString
PlantSelectselected_plant String
SlocSelectselected_slocString
Log Tag

Text Input(Type: Text)

selected_logtagString
Total LogsTexttotalLogsNumber
Last Scanned TagTextlastScannedLogtagString

Table 1-1: App variables in Home page

The data source of Plant is Plant Master. Refer the mapping in the screenshot below: 

4 Image 1-1 Plant Master - Data mappingI-5:Plant Master-Data mapping

Source Data (EdgeReady Database)App VariablesData Type
PI_PLANTSPlantMaster.PLANT_NAMEString (Primary Key)

Table 1-2: Additional variables in Home page

The PlantMaster is populated in the Initial Download.

The data source of Sloc is Sloc Master. Sloc Master should be filtered based on Plant value. For details on 'How to use Filter property for the Select component', refer the App Designer - Filter section. To see how Sloc value is mapped and filtered, refer the screenshot below:

5 Image 1-2 Sloc Master - Data MappingI-6:Sloc Master - Data Mapping

6 Image 1-3 Sloc Master - Data FilterI-7:Sloc Master - Data Filter

Source Data (EdgeReady Database)App VariablesData Type
PI_PLANTSSlocMaster.PLANT_NAMEString (Primary Key)
PI_PLANTSSlocMaster.STORAGE_LOCATIONString

                                                     Table 1-3: Additional variables in Home page

The SlocMaster is populated in the Initial Download. 

The current App implementation stores the input values entered in the Home page to the device data automatically when the End-User scans or types a barcode and clicks Enter in the Log Tag field. 

A table variable should be used to store this data for the following reasons: 

  • The variable should store a list of records.
  • The list of records should not be lost when the End-User exits the app or when the session expires. 

According to this use-case, one batch will have the same BatchName, Date and Plant. The Date and Plant fields are disabled for change once the user starts adding records to the active session. Therefore, the input values received in this page are segregated into two table variables: ‘Header’ and ‘Logs’. These two table variables are connected through the common computed value ‘BatchName’. The ‘BatchName’ is the Primary Key in both these tables. 

Note
Selection of Primary Key is mandatory in Offline apps.
Source DataApp VariablesData Type
BatchName (computed)

Header.BatchName

Logs.BatchName

String (Primary Key)
selected_dateHeader.DateString
selected_plantHeader.PlantString
selected_slocLogs.SlocString
selected_logtagLogs.LogTagString

                                                       Table 1-4: Additional variables in Home page

Home Page Scripts

After storing user preference in the Settings page; for every future login, the End-User is taken to the Home page.

Home->onPageShow event

In the onPageShow event, the session variables are computed and initialized. The following flowchart depicts the logic used:

17 Flowchart 1 Home page PageShow eventI-8:Home page - onPageShow event 

For sample Home Page onPageShow events, refer screenshots below. (Screenshots are captioned with the events in the above flowchart.)

18 Snippet 1-1 Home - PageShow - Is length of settings = 0I-9:Home - onPageShow - Is length of settings = 0 

19 Snippet 1-2 Home - PageShow - Is BatchName empty_I-10:Home - onPageShow - Is BatchName empty?

20 Snippet 1-3 Home - PageShow - Calculate record count in BatchNameI-11:Home - onPageShow - Calculate record count in BatchName
21 Snippet 1-4 Home - PageShow - Is BatchName current_ If yes, is record count = 0_I-12: Home - onPageShow - Is BatchName current? If yes, is record count = 0?
22 Snippet 1-5 Home - PageShow - BatchName NOT empty and NOT currentI-13:Home - onPageShow - BatchName NOT empty and NOT current

Functions written in Home Page onPageShow event

23 Snippet 1-6 Home - PageShow - Function_readSettingsI-14:Home - onPageShow - Function: readSettings 
24 Snippet 1-7 Home - PageShow - Function_initializeI-15:Home - onPageShow - Function: initialize

Variables used in Function: initialize are listed in the following table:

ComponentApp VariablesData TypePurpose
-NA-BatchName_currentStringTo keep track of batch created in current session

Text (for display purposes only)

BatchNameStringTo keep track of active batch

Home page ->textinput_date

boolEnable_textinput_date

String

To disable Date field in Home page after the first record added to current batch or when adding more records to an old batch

Home page -> select_plant

boolEnable_select_plant

String

To disable Plant field in Home page after the first record added to current batch or when adding more records to an old batch

Table 1-5: Variables used in Function: initialize

The feedback functions success_feedback and error_feedback are declared and defined as Global functions in Home Page onPageShow event.

25 Snippet 1-8 Home - PageShow - Global function_success_feedbackI-16: Home - onPageShow - Global function: success_feedback
26 Snippet 1-9 Home - PageShow - Global function_error_feedbackI-17: Home - onPageShow - Global function: error_feedback

There are two business function variables used in this business function to Show/Hide the feedback dialog box through App Behavior script as observed in the above Global function snippets.

App VariablesData Type
boolShow_dialog_feedbackString (True/False)
feedback_messageString

Table 1-6: Show/Hide variables

A feedback dialog box is implemented in every page of this business function with the following design:

27 Image dialog_feedback UII-18: dialog_feedback UI
28 Image dialog_feedback PropertiesI-19: dialog_feedback Properties

Home page -> select_plant -> onChange event

Similar to "select_plant change event in Settings page" Sloc Master has to be reset on select_plant change event in the Home page.

29 Snippet 1-10 Home page - Plant Change eventI-20: Home page - Plant Change event 
Note
Do no forget to populate SlocMaster_copy in the Initial Download BOS.

Home -> textinput_logtag -> onKeyUp event 

OnKeyUp event in Log Tag field, the input fields are validated and stored in device. The variables ‘Header’ and ‘Logs’ are used. Validations include: Field empty, LogTag not alphanumeric, LogTag length greater than 10, Previous LogTag scanned again, Duplicate LogTag scanned.

30 Snippet 1-11 Home page - Log Tag KeyUp event - Validate input fields and add record to device dataI-21:Home page - Log Tag KeyUp event: Validate input fields and add record to device data
31 Snippet 1-12 Home page - Log Tag KeyUp event - Function_ValidateAndAddI-22: Home page - Log Tag KeyUp event: Function: ValidateAndAdd
32 Snippet 1-13 Home page - Log Tag KeyUp event - Function_addLogI-23: Home page - Log Tag KeyUp event: Function: addLog

Was this article helpful?

ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence