0

Set Data Object Value

  • updated 10 mths ago

Description

The Set Data Object Value part allows you to set a variable (data object) to a specific value.

Use

You can use this part to set the value of a data object, either as a static value or a value that is derived from other context values. The Set Data Object Value part can be used to set a text, numeric, date, or html value of a data object, or create a container, collection. etc. The data object name can be upper or lower case and include numbers and some special characters, but no spaces. If your name does not meet the requirements a validation message is shown.

Tips and Tricks

The name of a data object can clearly identify what you mean it to store; for example, number_of_animals_in_zoo. While you can use both uppercase and lowercase letters, we recommend adopting a standard practice of using all lowercase letters or camelCase letters when defining variables.

For larger applications, we recommend that you create a a data model that provides naming conventions for the major variables/areas of the application, as well as temporary and scoping variables.

WARNING: The following words are reserved for the system and you should not use them in a data object name: and, break, do, else, elseif, end, false, for, function, if, in, local, nil, not, or, repeat, return, then, true, until, while.

Editor Fields

Field Name Description/Use Type/Options Optional/Mandatory
Path This is the name of the data object in which the user input will be stored. dataobject Mandatory
Value This is the value the system will store in the data object. Text Mandatory
Data object type This is the type of data:

text: The system stores the value as a text string.

number: The system stores the value as a number. The system stores a nil value when the value is a non-number.
Note: In versions of the application before v7.4, numeric was allowed. This has been deprecated and is replaced by number.

date: The system stores the value as a date. The system stores a nil value when the value cannot be interpreted as a date or if the source value is an empty string. The date value is a number representation; for example, 20170203.123456 is February third, 2017, 12 hours, 34 minutes and 56 seconds (24h format).

collection: The data object is treated as a collection, and the system adds the value to the collection. If the object is not an existing collection the system creates a new collection first. If the object is a collection that already contains the value, the system takes no action.

container: The system evaluates the Lua code that is entered as the value.

- If the value is a expression, the system fills the data object with the result of the expression.
- If the value is a Lua data structure, the system initializes the resulting data object with the data from the data structure.
- If the value is the name of another existing data object, the resulting data object is a reference/pointer to that data object. 


html: When selecting this option, the system marks the content of the data object as a safe HTML string.

boolean: Enter a '1' or 'true' and the system sets the data object to a boolean variable = true. (Or enter a '0' or 'false' to set variable = false)

null: Use this option to create or reset the data object to null value. Note that setting a text/numeric field with an empty value field will not create a null variable in the context.
Text | Number | Date | Collection | Container Mandatory
Date Format When the data object type is date, the system displays this dropdown menu with commonly used date formats. The system converts the input to your selected format. Date formats Optional
No interpolate The system interpolates the value by default. The system replaces $(data_object) with the contents of the data_object. Set this parameter to 'yes' to turn off this behavior. Yes | No Optional
Enable logging To activate logging of this part, set this parameter to 'yes'. See additional note below for using this option in Assessment Framework applications. Yes | No Optional

Example

Please download and import the following example project in your workspace.

 

Enable Logging: Assessment Framework Application

When using the Assessment Framework, the system clears the context of any logged items on each cycle (e.g. user click, entry of new data). At this point, the user inputs on the active pathway and any process nodes encountered are used to repopulate and change the context.

  • The system sets to the user input value any variables set by user inputs on the prior cycle and STILL on the active pathway.
  • The system clears any variables set by user inputs that no longer on the active pathway.
  • The system does NOT clear any variables set by process nodes, regardless of whether the process node is in the active pathway or not.

This has implications for modeling and the logging choices you make. For best modeling practice, you should delete any processing (non-form part) variables unless they are guaranteed to be set to alternative values after a rule; for example, if there is a set data object process node on both the TRUE and FALSE path following a rule.

In general, you should choose NO (default) for this option. Chose YES (save data object in log) under specific circumstances where the process variable is not reset/cleared by a process node on the active pathway.

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 10 mths agoLast active
  • 150Views
  • 5 Following

Home