Element Details: Condition+Filter
 Back


Available in: Logi Info Source code name: ConditionFilter

Use the Condition Filter to return only a subset of records from a DataLayer.

A Condition (or expression) is evaluated for each row then removes rows when the result is False. The expression is written in either standard Javascript or VBScript and usually contains tokens such as @Data to access specific values of each data row. Expressions can include almost any combination of tokens available in Info.

Set the ErrorResult attribute to indicate what should be done when the Condition fails with an error. The default ErrorResult is False so that rows with errors are removed.

In cases in which performance is most important, one or more CompareFilter elements may be added as children to compare and evaluate data values. The CompareFilter is often faster than scripting. First, add child CompareFilter elements that return True or False depending on data values. Then write the Condition so it uses just ANDs, ORs and parentheses, and @Compare tokens that match the IDs of CompareFilter elements.

Example with just Javascript, without CompareFilters:
Condition = "@Data.Freight~ > 50 AND ('@Data.CustomerID~' = 'HANAR' OR '@Data.CustomerID~' = 'MAGAA') "

Example with CompareFilters:
Condition = "@Compare.compareFreight~ AND (@Compare.compareCustomer1~ OR @Compare.compareCustomer2~) "
<CompareFilter ID="compareFreight" DataColumn="Freight" CompareType=">" CompareValue="50" DataType="Number" />
<CompareFilter ID="compareCustomer1" DataColumn="CustomerID" CompareType="=" CompareValue="HANAR" DataType="Text" />
<CompareFilter ID="compareCustomer2" DataColumn="CustomerID" CompareType="=" CompareValue="MAGAA" DataType="Text" />

Element Group:Filter Rows



ATTRIBUTES

Click attribute Name to drill down for more information.

NamePossible ValuesDescription
Condition
UserDefined
(Required) An expression that evaluates to a value of True or False. Expressions should be in JavaScript (recommended) or VBScript syntax. For .NET versions, the scripting language can be set in the _settings.lgx General element. For Java versions, the scripting language is always JavaScript. Typically, you would compare values using a token, such as "@Data.value~ < 0" or "@Session.ShowCol1~=='true'". Elements are removed when the Condition evaluates to False. Use quotes when working with strings: "@Data.myColumn~" == "SomeValue" If your data token may have a double quote inside of it, you should use single quotes: '@Data.myColumn~' == 'SomeValue' String valued data tokens with single and double quotes inside are not supported by the condition attribute.
ErrorResult
True
False
ErrorResult sets the value that is used whenever the Condition or script formula fails because of an error. For ConditionFilters, the default is "False". For CalculatedColumn and ExtraCrosstabCalculatedColum elements, the default is blank. Otherwise, the default is "???". Label's Caption attributes can have a script formula by making the first character the equals sign: "=".
ID
UserDefined
The ID attribute is a pervasive attribute that uniquely identifies an element within a definition file. The ID needs to be a unique value within the definition.
IncludeCondition
True
False
An expression that evaluates to a value of True or False. If the expression is blank, or evaluates to true the element is processed. If the expression evaluates to false, the element is skipped. Expressions should be in VBScript or JavaScript syntax. For .NET versions, the scripting language can be set in the _settings.lgx General element. For Java versions, the scripting language is always JavaScript. Typically, you would compare values using an operator, such as "@Session.value~ < 0". Use quotes when working with strings: "@Session.myValue~" == "SomeValue"



PARENT ELEMENTS

Click element to drill down for more information.

Authentication.SP
Authentication.SQL
DataLayer.Bookmarks
DataLayer.Cached
DataLayer.CSV
DataLayer.Definition List
DataLayer.Directory
DataLayer.ETL
DataLayer.Excel
DataLayer.Fixed Format File
DataLayer.Google App
DataLayer.Google Spreadsheet
DataLayer.GPX File
DataLayer.JSON
DataLayer.KML File
DataLayer.LDAP
DataLayer.Linked
DataLayer.Mongo Find
DataLayer.Mongo Map Reduce
DataLayer.Mongo Run Command
DataLayer.Plugin
DataLayer.REST
DataLayer.Scheduler
DataLayer.SimpleDB
DataLayer.SP
DataLayer.SQL
DataLayer.Static
DataLayer.Twitter
DataLayer.Web Feed
DataLayer.Web Scraper
DataLayer.Web Service
DataLayer.XML
Right.SP
Right.SQL
Right.Static
Right.XML File
User Roles.SP
User Roles.SQL
User Roles.Static
User Roles.XML File


CHILD ELEMENTS

Click element to drill down for more information.

Compare Filter


 Back to top


 Chart Debug