Returns the code of a list item. When you use the function on:
- a list, the Code returned is configured in the Grid View.
- a time-formatted line item, the function returns the selected time as text.
- x: line item to evaluate
|Input Format||Output Format|
|x: List item, time period||Text|
The function uses the following arguments:
- x: List-formatted or time period-formatted line item
The function has the following constraints:
- Source must be list-formatted or time period-formatted.
- Result must be text-formatted.
- If selected list item in source has no code defined, return is blank.
In this example, a list Sales Personnel has a Code assigned to each list item in theGrid View:
The model contains a simple Income Statement module with line items on rows, a time dimension on columns, and Organization and Versions as pages. A Sales Staff list-formatted line item has been added to the module, that is formatted on the Sales Personnel list and allows a list item on the list to be selected for each region for each quarter. We can then use CODE in the text-formatted Sales Personnel Code line item to show the selected salesperson's code:
List as a dimension
In this example, we have a simple Sales Commission Rates module belonging to the same model as the list-formatted example above, where the Sales Personnel list is used for the columns. We can then add a text-formatted Personnel Code line item. We use the ITEM function to return the list item used as the column heading by nesting it in the CODE function. This then returns the Code held for each of the column labels:
We can use a line item that is list-formatted to a time period as an argument.
added to Selected Month as CODE converts the selection in Selected Month to text format.