Creating Multiple Value Data Area Export Apps
You can use Longview Designer to create multiple value data area export apps.
Working with variables
You can use Longview Designer to create, modify, reorder, or delete variables for your app. Variables are optional. You might include variables in your app if you want to, for example, use an attribute such as the current time period, or if you want to prompt a user to select a symbol or a file.
Once you have created variables, you can use them elsewhere in your app by enclosing them in dollar signs ($ $).
For more information, see “Variables” in the Longview Developer’s Guide.
You can also use external variables not defined on the Variables page of your app by enclosing them in dollar signs ($ $).
Variables tasks include:
Creating variables
You can use Longview Designer to create variables for your app. Each variable you specify is created and set to the specified value when your app runs.
To create a variable:
- Open the Variables section.
- Do one of the following:
- To create a new variable at the bottom of the list, click Variable. The new variable appears at the bottom of the variables list.
- To create a new variable below a specific variable, select a row and click Variable. The new variable appears below the selected row.
- Complete the following fields:
Field Notes Name
Type the name of the variable. Do not prefix the variable name with “LV_” or “LVS_”.
Type
Specify the type of data to be stored in the variable using one of the following options:
- String — Designates a string value.
- Range — Designates a list of symbols.
- Number — Designates a numeric value.
- List — Designates a list of string values.
- NumberList — Designates a list of numeric values.
The default is String.
Expression
Specify the value that the variable is set to. Based on the Type field this can be a number, a string, or a list of symbols, respectively.
Note: You can include attribute values in an expression. To include an attribute value in an expression, you must first set a variable to the value of the attribute using an attribute token, and then use the variable. For example, you could create a string variable named “currentPeriod” and use the expression “[[SYSTEM,SGPCurrentPeriod,DBDefault]]”. For more information on setting variables, see “Set Variable” in the Longview Developer’s Guide. For more information on using attributes, see “Attribute tokens” in the Longview Developer’s Guide.
Modifying variables
You can use Longview Designer to modify existing variables for your app.
To modify a variable:
- Open the Variables section.
- Select the variable you want to modify and make the necessary changes.
Reordering variables
You can use Longview Designer to change the order of variables in your app. The order of variables is important because you cannot use a variable in an expression until you first define the variable. Variables are created in the same order in which they are defined.
To reorder a variable:
- Open the Variables section.
- Select the variable you want to reorder, and then click either Move Up or Move Down. The variable moves one row in the indicated direction.
- If you want to continue to move the selected variable, repeat step 2 until the variable is in the desired location.
Deleting variables
You can use Longview Designer to delete variables from your app.
To delete a variable:
- Open the Variables section.
- In the variables list, select the variable you want to delete, and click Delete. The variable is deleted.
Specifying pre-selection commands
Use pre-selection to perform any commands before symbol selection. The typical use of pre-selection is to perform advanced logic to determine default selections or set the range of possible symbols. Pre-selection commands are executed after symbol selection settings are applied from the app configuration, so all symbol selection variables have been created at this point.
See Generating a symbol selection form for details on symbol selection variables.
Note: Using pre-select commands to set default or symbols overrides the settings in User Selections.
Variable | Notes |
---|---|
<Dimension>Default |
Specify the default selection in the symbol selector, for the Dimension. |
<Dimension>Symbols |
Specify the list of available selections in the symbol selector for the Dimension. |
Example: Setting the list of possible symbols to all YTD periods
Create VARIABLE ytdPeriodList AS RANGE
Set VARIABLE ytdPeriodList = "[[SYSTEM,SGPTimePeriodsYTD,DBDEFAULT]]"
For EACH ytdPeriod in ytdPeriodList
Set VARIABLE TIMEPERIODSSymbols = ListAppend(TIMEPERIODSSymbols, "$ytdPeriod$#99")
Next
Specifying user selections
Use user selections to specify dimensions for which the user will be prompted to choose symbol(s). For each dimension that the user will choose symbols, right-click on the User Selections folder and choose Add Dimension. The dimension settings page will appear.
Variable | Notes |
---|---|
Dimension |
Select the dimension the user will be prompted to select symbol(s) for. |
Available selections |
Select a symbol to limit the possible symbols available to the user. If left blank the user will be able to select from all symbols available in the dimension. The available symbols will always be limited by user access. |
Default selection |
Select a symbol to specify as the default selection. This can either be a database symbol, an attribute symbol, or a floating time period. Note: Attribute symbols and floating time periods will only be available if they are defined in your system. |
Selection required |
Check this to force the user to select a symbol to continue. |
Allow leaf selection |
Check this to allow the user to select a leaf symbol. |
Allow parent selection |
Check this to allow the user to select a parent symbol. |
Allow read-only selection |
Check this to allow the user to select a read-only symbol. |
Allow multiple selections |
Check this to allow the user to select more than one symbol. |
Attribute filter |
Enter an attribute filter expression to further limit the possible symbol selections. |
Specifying attribute-based selections
Use Attribute Based Selections to specify selections for dimensions that are deter- mined by an attribute value. For each dimension to be determined via an attribute, right-click on Attribute Based Selections and select Add Dimension.
Variable | Notes |
---|---|
Dimension |
Select the dimension to select symbol(s) using an attribute value. |
Attribute class |
Select the class of attribute to use. |
Attribute name |
Select the attribute. |
Source dimension (SYMBOL class) |
If the attribute class is SYMBOL, select the source dimension. Note: The source dimension must be a dimension specified as a user selection or attribute-based selection. |
Note: The variable created to hold the attribute-based symbol will have the same name as the dimension. The variable created will be a STRING type.
Example, to set the currency selection to be the functional currency of the selected entity:
- Select the CURRENCIES dimension.
- Set the attribute class to SYMBOL.
- Enter “ZGPNativeCurrency” for the attribute name.
- Select ENTITIES for the source dimension.
Example, to set the time period selection to be the current period:
- Select the TIMEPERIODS dimension.
- Set the attribute class to SYSTEM.
- Enter “SGPCurrentPeriod” for the attribute name.
Specifying post-selection commands
Use post-selection to perform any commands after symbol selection, but before any data areas are created. The typical use of post-selection commands is to perform advanced symbol selection tasks. For example, you might use post-selection to create a list of all standard intercompany accounts. In addition, you may want to use a form to further refine selection, or instead of the template provided symbol selection.
Caution: Post-selection commands are executed as part of symbol selection within a view. Any Create VARIABLE commands will cause an error during symbol reselection. If “Allow user to change selections in view” is allowed, either create variables only in pre-selection, or wrap variable creation in VariableExists checks.
Example: Get a list of all standard intercompany accounts
If Not(VariableExists("ACCOUNTS"))
Create VARIABLE ACCOUNTS AS RANGE
END If
Set VARIABLE ACCOUNTS = CreateList(SYMBOLS, DATABASE, ACCOUNTS, "TB###")
Set VARIABLE ACCOUNTS = FilterList(ACCOUNTS, "[[SYMBOL,ZElimICSchTransactions,THIS]] == 'ICStandard'")
Example: Specifying multiple attribute time periods (current forecast and budget period)
If Not(VariableExists("TIMEPERIODS"))
Create VARIABLE TIMEPERIODS AS RANGE
END If
Set VARIABLE TIMEPERIODS = "[[SYSTEM,SGPForecastPeriod,DBDEFAULT]]" Set VARIABLE TIMEPERIODS = ListAppend(TIMEPERIODS, "[[SYSTEM,SGPBudgetPeriod,DBDEFAULT]]")
Example: Specify temporary symbols mixed with real symbols
If Not(VariableExists("TIMEPERIODS"))
Create VARIABLE TIMEPERIODS AS RANGE
END If
Set VARIABLE TIMEPERIODS = "[[SYSTEM,SGPForecastPeriod,DBDEFAULT]]"
Set VARIABLE TIMEPERIODS = ListAppend(TIMEPERIODS, DIFF")
Set VARIABLE TIMEPERIODS = ListAppend(TIMEPERIODS, "[[SYSTEM,SGPBudgetPeriod,DBDEFAULT]]")
To capture additional user input via a form, it is required that the button clicked be copied to the FORM_ButtonClicked variable to ensure expected app execution. Specifically, app execution continues if FORM_ButtonClicked has a value of “OK”.
Example: Capture additional user input via a form
Show FORM USING Custom.lvfrm
Set VARIABLE FORM_ButtonClicked = $LVS_BUTTONCLICKED$
Allowing currency re-selection in a data view input app
There may be cases where the initial selection in the app is based on the functional currency of the selected entity, but you want the user to be able to change the currency.
To accomplish this, follow these steps:
Note: Substitute CURRENCY for the name of your currency dimension, or use an attribute token or $CORE.DimensionInfo.KeyDimensionList[4]$ for CURRENCY for flexibility.
- In the pre-selection add the following to support currency selection:
//Configure currency selections for re-select in view
Create GLOBALVARIABLE CURRENCYDefault AS STRING
Create GLOBALVARIABLE CURRENCYOptions AS STRING
Create GLOBALVARIABLE CURRENCYSymbols AS RANGE
Create GLOBALVARIABLE oldSelectDimensionList[] AS STRING //used to restore symbol selection to original options
Set VARIABLE CURRENCYOptions = "11000"
Set VARIABLE CURRENCYSymbols = "SOURCEC###"
Create VARIABLE isCurrencySelection AS NUM //used to track in post-selection if the is changing currency only
- In the Post-Selection add logic to set the native currency on entity selection:
If Not(VariableExists("CURRENCY"))
Create VARIABLE CURRENCY AS STRING
END If
If $isCurrencySelection$ //reset selection options to allow regular symbol selections
Set VARIABLE FORM_SelectDimensionList = ListAppend(CORE_EmptyList, oldSelectDimensionList)
Set VARIABLE isCurrencySelection = 0
Else
Set VARIABLE CURRENCY = "[[SYMBOL,ZGPNativeCurrency,$ENTITIES$]]" //apply currency of selected entity
END If
- Add a View Action to allow the user to change currency (this will be a new button on the toolbar)
Set VARIABLE oldSelectDimensionList = ListAppend(CORE_EmptyList, FORM_SelectDimensionList)
Set VARIABLE isCurrencySelection = 1
Set VARIABLE FORM_SelectDimensionList = ListAppend(CORE_EmptyList, "CURRENCY")
Run PROCEDURE "VIEW\OnReselect.lvpro"
Specifying pre-export commands
Use pre-export commands to specify any commands to execute after the data area has been created and downloaded, but before the export has been executed.
Specify the data area definition
Use Data Area Definition to specify the data area to be queried for the export. Open the data area definition to specify its properties.
Note: The name of the data area definition is Main.lvdsp and the name of the data area created using it is daMain.
- For the Name, enter the name of your Trigger Area
Note: The name must 29 or fewer characters and only contain alphanumeric characters and underscore “_”.
- In the Options table, complete the following fields:
Field Notes Data type
Specify the data to be queried using one of the following options:
- ADJUSTED — Indicates that data queries include adjustments made via journal entries
- UNADJUSTED — Indicates that data queries exclude adjustments made via journal entries
Default is ADJUSTED.
Download type
Specify the type of data to be downloaded using one of the following options (download option specific in brackets):
- Exclude parent values — Indicates that parent data is excluded in the download (STANDARDLEAFONLY)
- Exclude parent and calculated values — Indicates that only leaf data that was submitted to the database via import, input or event calculation is included in the download (LEAFDATA).
Default is All data.
- In the Trigger Area table, complete the following fields for each dimension:
Note: The Spec and Level fields are not applicable if a symbol contains a variable.
Field Notes Symbols
Type a symbol name. Alternatively, you can use the symbol selector.
To add more than one symbol for a dimension, select a row containing the dimension for which you want to add another symbol and click Symbol.
To move a symbol up or down within a dimension, click Move Up or Move Down.
Note: To use the symbol selected by the user or defined by an attribute, enter the name of the dimension as a variable. For example, $ENTITIES$.
Spec
Indicate the symbol specification using one of the following values:
- All: Includes all symbols within the selected symbol’s hierarchy.
- Leaf: Includes only leaf symbols within the selected symbol’s hierarchy.
- Parent: Includes only parent symbols within the selected symbol’s hierarchy.
- Root and Parent: Includes only root and parent symbols within the selected symbol’s hierarchy.
Note: To use the symbol selected by the user or defined by an attribute, enter the name of the dimension as a variable. For example, $ENTITIES$.
Level
Specify the number of levels down from the symbol to be included in the data area.
-
Use Additional Configuration to specify any other Data Area Definition features you wish to use. Additional Configuration is a code editor that allows you to enter data area definition functions to be included in the data area.
For more information on the code editor, see Using the Code Editor.
Typical use of Additional Configuration in a data area definition is to
- Add an attribute filter using the AttributeFilter function
- Add a schedule to the using the Schedule function
- Add a temporary symbol using the TempSym function
Specifying the data export spec
Use the data area export spec to specify how the data downloaded to the data area is converted to records in the target file.
To specify the data area export spec:
- Open the Data Area Export Spec.
- Fill in the Target File table:
Field Notes Target file
Specify the path and name of the data target.
Note: If the user is selecting the file you can use the name of the variable here. In addition, you must set the property EXP.FileName for the app to execute correctly.
Field Delimiter
Specify whether the character used to separate fields in the data source is the brace ( { ), comma ( , ), semicolon ( ; ), pipe ( | ), or regional delimiter for comma separated values ( , (regional) ). Alternatively, you can type a field delimiter of your choice.
The default is the regional delimiter for comma separated values ( , (regional) ).
Dimension corresponding to values
Specify the dimension for which there are multiple value fields.
-
In the Data Options table, complete the following fields:
Field Notes Reverse value for credit accounts
Specify the path and name of the data target. Select this option to reverse the sign for numeric values for accounts with Credit as the Balance Type.
For more information on the balance type in the ACCOUNTS dimension, see “Working with dimensions” in the Longview Application Administrator Guide.
The default is No.
Decimal character
Specify the decimal character for the data import app using one of the following values:
- “ . ” — The period is the decimal character.
- “ , ” — The comma is the decimal character.
- “ . (regional) ” — Use the regional character for the decimal.
The default is the regional character for decimal “ . (regional) ”.
Allow duplicate mappings
This option applies only when at least one dimension’s Type is Map.
Select this option to indicate that duplicate mappings are permitted. If multiple mappings are found, the system does the following for each type of mapping:
Exact — All duplicate Exact mappings are used so that the same value is imported to multiple data cells. If there are duplicate Exact and Wildcard or Range mappings, the Exact mapping is used, and the Wildcard or Range mapping is ignored.
Wildcard — If no Exact mappings are found, the value is imported to the first Wildcard or Range mapping listed.
Range — If no Exact mappings are found, the value is imported to the first Wildcard or Range mapping listed.
If you do not select this option, duplicate mappings are not permitted. If multiple mappings are found, the system reports an error for each mapping.
The default is No.
Handling for duplicate records
Specify the way duplicate records are handled for the data import app using one of the following values:
- Output all — Specifies that each duplicate record will be written to the target file.
- Error — Specifies that duplicate records should not be allowed. The first entry is submitted. If a duplicate record is encountered, the system reports an error.
- Sum values — Specifies that duplicate records should be allowed and the value of all such records summed. If a duplicate record is encountered that contains text (versus numeric) data, it is treated as an invalid/error record.
The default is Error.
Number of errors before processing stops
Specify the maximum number of error records to permit before stopping the import process.
The default is 0.
Custom header
When the header option is set to Custom, enter the header records in the form: ‘header record’, ‘...’, ‘header record’. Each header record is output on a new line in the target file.
-
The Dimension Definitions section is used to specify how each dimension is processed during export. For Dimension Definitions, complete the following:
- Schedule: This field displays only if your system is configured to use schedules and you have access to schedules.
- The default of None indicates the export spec is for base data only.
- Specify the schedule to use for the import spec, and the schedule dimensions appear at the bottom of the list of Dimensions.
- For each dimension, complete the following fields:
Field Notes Dimension
The name of the dimension.
Type
Specify the type of relationship between dimension symbols and field values in the data source using one of the following values:
- Map — The dimension symbols are mapped to values as specified in the indicated map.
- Match — The dimension symbols are written out with their names.
- Unique — Values for the symbol specified are exported, but the symbol name is not written in the target file.
Note: For a multiple values export spec, the dimension you indicated has Values for the Type field and cannot be changed.
Field Name This field is available only when Type is Map or Match.
Optionally, enter the name of the field. If the field name is not specified it will be set to Field with the Field Position appended.
The field name is used to specify filters.
Field Position
This field is available only when Type is Map or Match.
Specify the field position to assign the dimension to using a positive integer. For example, for the Accounts dimension, type 3 if the account will be the third column of the data target.
Symbol
This field is available only when Type is Unique.
Type the symbol name for the specified dimension to which the data is imported. Alternatively, you can use the symbol selector.
Note: You can also use a variable to define the symbol.
Map Location
This field is available only when Type is Map.
Indicate the location of the map using one of the following values:
- Internal — Indicates the map exists inside the database, created using the Mappings editor. For more information, see "Maintaining mappings".
- External — Indicates the map exists as a file, such as a text file on your local machine or network location.
- Document — Indicates the map exists as a document within the Symbol Maps folder of the app.
Map
This field is available only when Type is Map.
Do one of the following:
- If you selected Internal as the Map Location, select a map from the list of available maps in the system.
- If you selected External as the Map Location, type the path of the external map or click the ellipsis button ( ... ) to select the external map.
- If you selected Document as the Map Location, select a map from the list of available maps in the app.
Note: You can use a variable for the Map field if the map location is Internal or External.
-
The Values Field section is used to specify the field position for each symbol to be exported in the Values dimension. Complete the following fields:
Field Notes Field Name Optionally, enter the name of the field. If the field name is not specified it will be set to Field with the Field Position appended.
The field name is used to specify filters.
Field Position
Specify the field position of the value field using a positive integer, where the field position is the corresponding column in the data source containing the data. For example, if the value is exported to the third column in the target file, type 3.
Symbol
Type the name of a symbol from the dimension indicated in Multiple Value Fields for Dimension for the value in the corresponding field position. Alternatively, you can use the symbol selector.
Note: You can use a variable for the Symbol field.
Note: You can delete a value field by selecting a value field row and clicking Delete.
- You can optionally specify filters to apply when exporting data. For each filter type an expression using the following guidelines:
- The expression can be joined by two or more expressions using AND or OR and grouped by brackets, as appropriate.
- Each expression uses field names, operators, and values as follows: FieldName EQ|NE|LE|LT|GE|GT Value. If Value is a string, enclose the string in double quotation marks.
- You can optionally include wildcard characters (? and *) and symbols for Value.
Note: In this case do not enclose Value in double quotation marks.
- You can optionally use symbols for operators, such as ==, !=, <=, <, >=, and >.
- You must use Field# for FieldName to refer to a specific field on which you want to filter. For example, if Products is the fourth column in your target file and you want to filter Products to import only the Products_Default symbol, use Field4 == "Products_Default" as the expression.
Note: For more information on creating expressions, see “Using conditional operators” and “Search” in the Longview Developer’s Guide.
Specifying post-export commands
Use post-export commands to specify any commands to execute after the export has been executed.
Specifying Symbol Maps
Symbol Maps(.lvmap) specify instructions when the symbol names in your data target do not match the symbol names in your Longview database.
For more information, see “Developing Longview ImportSpecs, ExportSpecs, and external Maps” in the Longview Developer’s Guide.
For more information on using the code editor, see Using the code editor.
Specifying forms
Use Forms to capture user input:
- In an action within an input template
- During post-selection in an app
For each form complete the following fields:
Field | Notes |
---|---|
Name |
Enter the name of the form. |
Title |
Enter the title for the form. This is optional. If left blank the title of the form will be the same as the description of the app. |
Width (in pixels) |
Enter the width of the form. If not specified, the default width of 450 is used. |
Height (in pixels) |
Enter the height of the form. If not specified, the height is determined by the number of controls in the form. |
Format for the date value returned |
Enter the format a date is stored in an application framework variable when returned from a form. The format in the form is determined by the user’s regional settings. |
Form controls |
Add the controls to be displayed in the form via the code editor. For more information on the code editor, see Using the code editor. |