Format Data Object (Format Variable)
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. NOTE: This version of the topic relates to LogicNets v7.4+.
Node Type: This part is located in process nodes under the Data Objects dropdown menu.
Used With: This part can be used with all frameworks and on projects not based on a framework.
Editor Fields
This part displays parameters options based on the type of data object you want to format. The fields the system displays depend on selections you make in the editor.
All Data Sources
For all data source selections, the system displays the following options:
Field Name | Description/Use | Type/Options |
Mode | This field tells the system how to handle the data object: 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 |
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 |
Mode = "Process" | ||
Format | When you set Mode to "Process", this field is visible and displays a dropdown menu that tells the system when to process a data object. With Release 8.2+, if you select "Always" you can optionally add text to the Null value display box. The system presents this text next to the caption when the data source is null. Consider "not selected" for radiolists, "none checked" for checklists, and "not answered" for text inputs. |
- When source has a value - Always |
Data target | This field contains the name of the object in which the system stores the formatted result; for example, you could use birthdate as the value the user enters and birthdate_formatted for the date in your desired format. | Text |
Target Type | If you set Mode to "Process", the system displays this option.
|
- Text - HTML |
Mode = "Present" | ||
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 $(..)-caption | Check this box if your data object includes $(..) variables that should NOT be encoded. For example:
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. |
On | Off |
Show caption | If you set Mode to "Present" this field is visible. 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".' With Release 8.2+, if you select "Always" you can optionally add text to the Null value display box. The system presents this text next to the caption when the data source is null. Consider "not selected" for radiolists, "none checked" for checklists, "not answered" for text inputs. |
- When source has a value - Always |
Prefix | You can opt to put information after before the user's answer or leave it blank. This field will accept HTML and other variables in the $(variable_name) format. Enter a space after the text in the prefix field to force a gap between the prefix and the user's answer. | Text |
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 |
Data Source Type = Text
If the data source type you want to format is "text" the system displays the following options in addition to the ones in the All Data Sources section:
Field Name | Description/Use | Type/Options |
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 tells the system how many characters to display. | Number |
Data Source Type = Number or Currency
If the data source type you want to format is "number" or "currency" the system displays the following options in addition to the ones in the All Data Sources section:
Field Name | Description/Use | Type/Options |
Decimals | This field identifies the number of decimal places required in the answer. | Number |
Round/Truncate | Choose from the following options:
|
- system default - (none) - truncate - round - round whole |
Decimal separator | Choose from the following options:
|
- system default - dot - comma |
Thousands separator | Choose from the following options:
|
- system default - dot - comma |
Brackets around negative numbers | Choose from the following options:
|
- system default - No - Yes |
Currency symbol (currency only) |
This field allows you to enter the text/symbol for currency; for example, GBP or $. | Text |
Symbol location (currency only) |
Choose from the following options:
|
- system default - Prefix - Postfix |
Data Source Type = Collection
If the data source type you want to format is "collection" the system displays the following options in addition to the ones in the All Data Sources section:
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 '%' |