Demorize Digital Signage Software

17.2.2. Reference To Data Item Values

In some cases you want to embed just a bit of the data from a data item in the presentation. This is especially the case with text objects where you might want to embed some dynamic data in the middle of your own text. In this case you can reference a special field within a data item and have that placed within the rest of your text.

Special reference markers are used to tell that data shall be retrieved from a data item. The marker is replaced with the value from the data item upon presentation on the screen. The notation for the reference markers are "@{datasource.dataitem#format}" or "@{datasource.dataitem:field|separator}". The "datasource.dataitem" part points out a value or record set in a data source. If it is preceded with a ! character, it means that the data shall be updated as often as possible. This is usually not a good idea for data sources that take time to query. The system data source is however good to retrieve in this way since you then get fresh data presented every screen update. The dataitem part can point out a cell in the record set using a notation "dataitem:field[record]", where field is replaced with the field, or column, name and record is replaced with the record number counting from zero. The record part could also be "field=value" for looking up a specific record. You can also use a function, like "count()" instead of the field/record part to retrieve the number of records in a record set. The part with the colon and after is optional and will return the first cell and the first record if it is not specified. The format part is also optional but can be used if you would like to format the final value before it is presented.

Using a field as data without specifying a record will concatenate all cells in that field. The separator part is optional but can be used to add a separator character or string between cells if it is specified.

Table 17.3. Examples of data item references

Data item reference stringFormatted output
@{system.date}2009-10-07
@{!system.date.day}7
@{system.date.day#02}07
@{datasource.dataitem:Foo[3]}Cell value in record 3 and field Foo
@{datasource.dataitem:count()}Number of records in the record set
@{datasource.dataitem:Bar|*}Concatenate all cells in the field Bar and add a star between them
@{datasource.dataitem#.3f}f means that the data item shall be handled as a float value and .3 that it shall be displayed with 3 decimals
@{datasource.dataitem#+04d}d means that the data item shall be handled as an integer value, + that the sign shall be displayed even if it is a positive number, 4 that it shall be displayed with at least 4 characters and 0 that zeroes shall be used as padding (instead of spaces which is default if 0 is not specified)
@{datasource.dataitem#.5s}s means that the data item shall be handled as a string and .5 that the string shall be cut if longer than 5 characters