Special Functions and Attributes

Logi Info includes special functions and attributes for special purposes. These functions and attributes are discussed in this topic and include:

IIF Function

The built-in IIF() function is similar to the "inline if" found in other languages and the ternary operator (?) found in standard JavaScript. This function, which allows conditionalprocessing in a single line of code, is very useful in element attributes that accept expressions. The function's syntax is

    IIF(<expression>, <value if true>, <value if false>)

The following examples illustrate some of the ways to use the IIF function. Note that the function name may need to be prefixed with an equals sign depending on the element and attribute.

In a Label element's Caption attribute

The IIF function can be used in any "formula attribute", an attribute that is capable of evaluating a formula, such as the Label element's Caption attribute.

For example, as shown above,

    =IIF(@Data.Color~ = 1, 'Red', 'Green')
will display the appropriate text , Red or Green, in the Label based on the data value.

In a Calculated Column Element's Formula Attribute

The IIF function can be used in combination with other intrinsic string functions in an expression to generate the correct value.

If used in the Calculated Column element's Formula attribute, as shown above, the IIF function can be used to generate a new column that replaces part of a SQL time string with the Eastern Daylight Time or Eastern Standard Time acronym (EDT or EST):     IIF(Right("@Data.CurrentDateTime~",6) = "-04:00", "EDT", "EST") Note that the equals sign is not required before the "IIF" in this attribute. Relatively complex combinations of string functions can be created, including those that incorporate nested IIF functions.

Back to top


CXMLDate Function

DateTime-type data returned into a datalayer from a databases is often in ISO 8601 format, which looks like this:

    2007-05-31T13:30:00      (representing yyyy-mm-ddThh:mm:ss)

If you wish to use script functions to compare, manipulate, or format the date data, you need to convert it into a compatible format. Logi's intrinsic CXMLDate function has been provided for this purpose. The following example uses an intrinsic function to add one day to a date value,

    =DateAdd("d", 1, CXMLDate("@Data.EnrollmentDate~"))

and the CXMLDate function has been used to convert the data retrieved from the database. Here's another example that finds the difference, in days, between dates in two separate date-type columns,

    =DateDiff("d", CXMLDate("@Data.OrderDate~"), CXMLDate("@Data.ShippedDate~"))

and, once again, the CXMLDate function is used to convert the date values for use with the intrinsic DateDiff() function.

Back to top


DontResolveTokensInData Attribute

There may be times when you need to store text in a table column that includes Logi tokens. This might happen in documentation, for example. Under normal circumstances, when this text is retrieved into a datalayer, the Logi Server Engine will attempt to resolve any tokens in the text and if it does, the representation of the token will disappear from the text and be replaced with (usually) an empty space.

Token processing can be suppressed by manually adding a special attribute to the General element in the _Settings definition. This is done in Logi Studio by opening the _Settings definition, clicking the Source tab at the bottom of the Workspace panel, and manually edit the General element's source code. Add the special attribute, DontResolveTokensInData, set to True, to the General element:     <General DontResolveTokensInData="True" rdDebuggerStyle="DebuggerLinks"  ... etc.  />

The Debugger Style or any other attributes in the source code should remain as you found them. Save your definition and tokens will now be left alone when they appear in your data.

Back to top