0

Format Data Object (Format Variable)

  • updated 2 yrs ago

Redirect to the Report Item Form Part article for context-specific information on using this part as a Report Item node in the LogicNets Assessment Framework.

Below is a similar article relating to the general use of format data object as a process step.

Description

The format data object part is available in process nodes under the Data Objects dropdown menu. It allows you to format a particular data object and present it or process it using parameters related to the data object type. For example, if your data object is a date, this part allows you to format the way your application users see the date. 

Editor Fields

This part displays parameters options based on the type of data object you want to format. 

Data Source Type = Text

If the data source type you want to format is "text" the system displays the following options:

Field Name Description/Use Type/Options
Mode This field tells the system how to handle the report item: either to present it or to process it. Most commonly, users select "Present" to present the results of the formatting. However, it is possible for this node to act like a process node and transform an object variable (e.g. convert a date to a different format) and the result is stored in a new variable that can be used for further processing and/or presented at a later point in the report. - Present
- Process
Data source This is the answer or text you asked the user for that you want to display in your report. It is the data object you identified; for example, if you asked your user for her first name, it would be firstname.

If you use the ellipsis () to choose Data source from the data model the system will complete additional details—such as type—automatically. 
Data object
Data source type This tells the system whether to show the value the user entered/selected or the caption assigned to their selection option in Data source. Note: If you select "Caption" but your item does not have an assigned caption the data item will not display. - Value
- Caption
Caption If your item does not contain a caption but you want to display one in your report you can enter it in this field.

When choosing the data source from the data model the caption is automatically populated with the question, but you can edit this field to include any alphanumeric text, HTML codes, and other variables from the context (the syntax is $(variable_name)).
Text
Escape $(..)-text Uncheck this box if your data object includes $(..) variables that should NOT be encoded.  For example:
mytext = "<b>Hello</b>
$(mytext) will appear as Hello (off) or <b>Hello</b> (on)

If the data object contains several interpolations and only some of them need to be escaped, use the $(html(mytext)) construction to turn off escaping for specific output.
$(html(mytext)) appears as Hello 
On | Off
Show caption With this field you tell the system to either show the caption you have for the item by selecting "Always", or to hide the caption if the user did not provide an answer to the question. To do this you use "When source has a value". - When source has a value
- Always
Postfix You can opt to put information after your user's answer or leave it blank; for example, if you have asked in the question for a unit of measure you could put "mm" or "inches" after the user's answer in the report. This field will accept HTML and other variables in the $(variable_name) format. Enter a space first in the postfix field to force a gap between the user's answer and the provided postfix. Text
Type This tells the system what type of data is provided with the data source. The system displays additional formatting options for some of the data sources; for example, if the data source is a collection the system provides options for displaying a list of items. - text
- number
- collection
- date
- date_time
- currency
Character limit This tells the system how many characters to display. Number

Data Source Type = Number

If the data source type you want to format is "number" the system displays the following options:

Field Name Description/Use Type/Options
Mode This field tells the system how to handle the report item: either to present it or to process it. Most commonly, users select "Present" to present the results of the formatting. However, it is possible for this node to act like a process node and transform an object variable (e.g. convert a date to a different format) and the result is stored in a new variable that can be used for further processing and/or presented at a later point in the report. - Present
- Process
Data source This is the answer or text you asked the user for that you want to display in your report. It is the data object you identified; for example, if you asked your user for her first name, it would be firstname.

If you use the ellipsis () to choose Data source from the data model the system will complete additional details—such as type—automatically. 
Data object
Data source type This tells the system whether to show the value the user entered/selected or the caption assigned to their selection option in Data source. Note: If you select "Caption" but your item does not have an assigned caption the data item will not display. - Value
- Caption
Caption If your item does not contain a caption but you want to display one in your report you can enter it in this field.

When choosing the data source from the data model the caption is automatically populated with the question, but you can edit this field to include any alphanumeric text, HTML codes, and other variables from the context (the syntax is $(variable_name)).
Text
Escape $(..)-text Uncheck this box if your data object includes $(..) variables that should NOT be encoded.  For example:
mytext = "<b>Hello</b>
$(mytext) will appear as Hello (off) or <b>Hello</b> (on)

If the data object contains several interpolations and only some of them need to be escaped, use the $(html(mytext)) construction to turn off escaping for specific output.
$(html(mytext)) appears as Hello 
On | Off
Show caption With this field you tell the system to either show the caption you have for the item by selecting "Always", or to hide the caption if the user did not provide an answer to the question. To do this you use "When source has a value". - When source has a value
- Always
Postfix You can opt to put information after your user's answer or leave it blank; for example, if you have asked in the question for a unit of measure you could put "mm" or "inches" after the user's answer in the report. This field will accept HTML and other variables in the $(variable_name) format. Enter a space first in the postfix field to force a gap between the user's answer and the provided postfix. Text
Type This tells the system what type of data is provided with the data source. The system displays additional formatting options for some of the data sources; for example, if the data source is a currency the system provides options for displaying numbers with currency symbol etc. - text
- number
- collection
- date
- date_time
- currency

Currency symbol
(available with type = currency only)

Enter the text/symbol for currency. e.g. GBP or $

Text

Symbol location
(available with type = currency only)

Choose the location for the symbol as follows:

* system default: choosing this option accepts the defaults for round/truncate as specified in the SystemConfig package. Using this option allows the Designer to maintain and/or update consistent choices across the application

* Prefix: show the symbol in front of the number, e.g. $10

* Postfix: show the symbol after the number e.g. 10 €

- system default
- Prefix
- Postfix

Decimals  Enter the number of decimal places required in the answer.

Number

Round / truncate

 Choose from the options available:

* system default: choosing this option accepts the defaults for round/truncate as specified in the SystemConfig package. Using this option allows the Designer to maintain and/or update consistent choices across the application

* - (no round/truncate)

* Truncate: truncates the number to the specified number of decimals

* Round: rounds the number to the specified number of decimals above

* Round whole: rounds to the number of digits to the left of the decimal point

- system default
- (none)
- truncate
- round
- round whole
Decimal separator

Choose from the options availlable:

* system default: choosing this option accepts the defaults for round/truncate as specified in the SystemConfig package. Using this option allows the Designer to maintain and/or update consistent choices across the application

* . (dot): will show numbers as 123.456 for example

* , (comma): will show numbers as 123,456 for example

- system default
- dot
- comma
Thousands separator

Choose from the options availlable:

* system default: choosing this option accepts the defaults for round/truncate as specified in the SystemConfig package. Using this option allows the Designer to maintain and/or update consistent choices across the application

* . (dot): will show numbers as 123.456 for example

* , (comma): will show numbers as 123,456 for example

- system default
- dot
- comma
Negative Numbers

Choose from the options available:

* system default: choosing this option accepts the defaults for negative numbers as specified in the SystemConfig package. Using this option allows the Designer to maintain and/or update consistent choices across the application

* No: negative numbers will not be shown with parentheses, e.g. -123456

* Yes: negative numbers will be shown with parentheses, e.g. (123456)

- system default
- No
- Yes
Round whole  If you click this checkbox the system will round the user's answer to the nearest whole number.   Checked | Unchecked

Data Source Type = Collection

If the data source type you want to format is "collection" the system  displays the following options:

Field Name Description/Use Type/Options
List view This allows you to set the format options for displaying your list. - Comma
- *-separator
- custom
- comma and
- bullets
- list
- quoted and comma separated
- no delimiter
Key This field specifies the object within the collection you want to display in your report. As an example, if you have a collection with user_choice[1].preference and user_choice[1].state enter "state" in this field to show only that set of objects. Text

Value template

You can use this field to display multiple items from a collection in your report. Each key or object has to be defined as $(object). Other text and HTML is also allowed in the field, but you should not include contextual variables that do not exist in the collection. Example: a value template of #$(preference) - $(state) would deliver
#1 – NY
#2 – CA
#3 – DC

It is also possible to include div classes and/or column HTML elements to create and style these values in a table format.

Text

Data Source Type = Date

If the data source type you want to format is "date" the system displays the following options:

Field Name Description/Use Type/Options
Date format This tells the system how to display the date. You can use options such as dd-mm-yy to show two digits for the date, two digits for the month, and two digits for the year with a dash between each. Note: you must use lowercase letters. Text
Date format (when only month/year are available) This tells the system how to display the date if only the month and year are available. Enter your formatting into the field using options such as mm/yy to show the month with two numbers and the year with two numbers; for example, February 2019 would display as 02/19. Note: You must use lowercase letters. Text
Date format (when only year is available) This tells the system how to display the date if only the year is available. Enter your formatting into the field using either yy or yyyy to show the year with all four numbers or with only to numbers. As an example, if you put yy the system will display 2019 as 19. Note: You must use lowercase letters. Text

Data Source Type = date_time

If the data source type you want to format is "date_time" the system displays the following options:

Field Name Description/Use Type/Options
Input type This dropdown allows you to select the input type used for your date_time: YYYYMMDD.HHMMSS | Epoch Datetime
Time zone This dropdown allows you to determine if the system uses the time zone of the server on which your application is hosted or GMT as the time zone of your data object: Server | GMT Dropdown
Date format This tells the system how to display the date. You can use %d %b %Y for 14 Feb 2019, for instance. See the table below for acceptable date formats. Additional characters can be used -- so %d xxx %m will show a date as 14 xxx Feb, for example. Text
Date format (when only month/year are available) This tells the system how to display the date if only the month and year are available. Enter your formatting into the field using options such as mm/yy to show the month with two numbers and the year with two numbers; for example, February 2019 would display as 02/19. See the table below for other acceptable formats. Text
Date format (when only year is available) This tells the system how to display the date if only the year is available. Enter your formatting into the field using either yy or yyyy to show the year with all four numbers or with only to numbers. As an example, if you put yy the system will display 2019 as 19. See the table below for other acceptable formats.  Text
Date/Time separator This is the character the system will display between the date and time. If this field is blank the system will use a space as the default separator. String
Time format This tells the system which format to use to set the time. You can use options like %I:%M %p to show the Meridian time. See the table below for other acceptable formats.  Text
Do not escape HTML If you have used HTML codes in the value template, check this option to prevent the security features from presenting the HTML codes as text. Checkbox
Character limit This field allows you to set a limit on the number of characters the system displays in the report. Number

Acceptable Date Formats

The following table details the codes you can use to create acceptable date formats.

%a abbreviated weekday name (e.g., Wed)
%A full weekday name (e.g., Wednesday)
%b abbreviated month name (e.g., Sep)
%B full month name (e.g., September)
%c date and time (e.g., 09/16/98 23:48:10)
%d day of the month (16) [01-31]
%H hour, using a 24-hour clock (23) [00-23]
%I hour, using a 12-hour clock (11) [01-12]
%M minute (48) [00-59]
%m month (09) [01-12]
%p either "am" or "pm" (pm)
%S second (10) [00-61]
%w weekday (3) [0-6 = Sunday-Saturday]
%x date (e.g., 09/16/98)
%X time (e.g., 23:48:10)
%Y full year (1998)
%y two-digit year (98) [00-99]
%% the character '%'
Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 2 yrs agoLast active
  • 156Views
  • 5 Following

Home