DataLayer.Definition List

The DataLayer.Definition List element provides developers with programmatic information about the definitions used in their application. The data can then be used to create report menus, report management systems, and more.


For similar functionality for any file (not just definitions) see our DataLayer.Directory element.  

Attributes

The DataLayer.Definition List element has the following attributes:
 

Attribute

Description

ID
Specifies an optional element ID. We recommend you specify one for easier identification when debugging.
Definition List Folder Enter a file system folder name here to restrict the results returned to definitions within a single folder. The folder named is assumed to be within the _Definitions folder of the application's project folder. Examples: _Processes, _Reports, _Templates, _Widgets Default: Returns data for all definitions
   

Working with DataLayer.Definition List

The datalayer reads the definition data for the current project and caches it as rows and columns, with one row per definition file. Data retrieved into the datalayer is cached in the usual XML format.

The data retrieved with a datalayer is available using @Data tokens, in the format @Data.ColumnName~. The spelling of the column name is case-sensitive. The data is only available within the scope of the parent element of the datalayer, not throughout the entire report definition. The DataLayer.Linked element can be used to make the data reusable in another datalayer outside this scope.

Column returned into the datalayer and available through the @Data token are:
 

Column Name

Description

DefinitionName
The definition name, as it appears in the Application panel, e.g. Default
DefinitionType The definition type, e.g. Report, Process, Template, or Widget
CaptionThe Caption attribute value (for Report definitions).
EngineVersionThe build number of the version of the Logi Server Engine used, e.g. 12.0.30
Filename The fully-qualified filename of the definition file, e.g.
c:\inetpub\wwwroot\TestApp\_Definitions\_Reports\CrosstabSample.lgx
Foldern For easier organization, Logi definition files can be named using period-separated prefixes, such as Accounting.ProfitLoss.lgx. The prefixes are referred to as folders, though they don't exist in the file system as such. This column returns the nth prefix or folder name for each definition. Examples: For Accounting.Profits.lgx, the Folder1 column returns "Accounting"
For New.Accounting.Profits.lgx, the Folder2 column returns "Accounting" Due to the optional nature of these prefixes, the AutoColumns element may not detect all instances of this column in the datalayer.
ID The Report ID from the report definition's root node, ID attribute.
SavedAt The timestamp indicating when the definition was last saved, e.g. 3/8/2008 2:25 PM
SavedByUser name of the person who last saved the definition.
  If the Alternative Definition Folder attribute is set in the _Settings definition's Path element, the datalayer also includes definition objects from that folder. The data retrieved into the datalayer can be viewed by turning on the Debugging Link in the _Settings definition (General element) and using the resulting icon at the bottom of the report page to view the Debugger Trace Page. A link on the Trace page will display the retrieved data.  

Example Usage: With an Input Select List

In the following example, you'll see how to use DataLayer.Definition List with an Input Select List element, so that users can select report definitions to see at runtime.
 

Start by adding an Input Select List element to your report definition and setting its attributes as shown above. Referring to the table of returned columns from the previous section, use "DefinitionName" for the Caption Column and Value Column attribute values.
 

Next, add a DataLayer.Definition List element beneath the input element, as shown above. You only want to present users with a choice of report definitions, so set the Definition List Folder attribute to _Reports. Without this, they'd also see Process, Widget, and all other definitions.
 

When you preview the report, you see that your list is populated, but there's a problem: the list includes many report definitions in subfolders that you don't want users to see. To fix this, filter the datalayer:  

As shown above, add a Compare Filter beneath the datalayer. Set its attributes to keep only definitions that have an underscore in their names.  

Now when we preview the definition again, we see that the list includes the desired set of definitions.