Element Details: Sql+Compare+Filter
 Back


Available in: Logi Info Source code name: SqlCompareFilter

In cases in which performance is most important, one or more SqlCompareFilter element may be added as children to compare and evaluate data values. The SqlCompareFilter is often easier to use than a large SqlConditionFilter. First, add child SqlCompareFilter 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 SqlCompareFilter elements.

Example with just SQL condition, without SqlCompareFilters:
SqlExpression = "@Data.Freight~ > 50 AND ('@Data.CustomerID~' = 'HANAR' OR '@Data.CustomerID~' = 'MAGAA') "
Example with SqlCompareFilters:
Condition = "@Compare.compareFreight~ AND (@Compare.compareCustomer1~ OR @Compare.compareCustomer2~) "
<SqlCompareFilter ID="compareFreight" DataColumn="Freight" CompareType=">" CompareValue="50" />
<SqlCompareFilter ID="compareCustomer1" DataColumn="CustomerID" CompareType="=" CompareValue="HANAR" />
<SqlCompareFilter ID="compareCustomer2" DataColumn="CustomerID" CompareType="=" CompareValue="MAGAA" />

CompareTypes:

=,<,>,<=,>=,!=
Basic comparison operations.

Between
The CompareValue must include two pipe ("|")separated numeric or date values. Rows with column values equal to or within the range remain.

Contains
Rows with DataColumns containing the CompareValue string value remain.

InYear, InMonth, InQuarter, InWeek and InDay match when the dates being compared are within the same time-span.

InList
DataColumn values that match an item in a comma-delimited list.

NotContains
Rows with column values that do not contain the CompareValue remain.

NotInList
DataColumn values that do not match any item of a comma-delimited list.

NotStartsWith
DataColumn values that do not start with the CompareValue remain.

StartsWith
DataColumn values that start with the CompareValue remain.




ATTRIBUTES

Click attribute Name to drill down for more information.

NamePossible ValuesDescription
CaseSensitive
True
False
DataSourceCollation
Set CaseSensitive to "False" when comparing and matching values regardless of character case. For elements using DataLayer.ActiveSQL, CaseSensitive may be set to "DataSourceCollation". Then case sensitivity is defined by the database column's "collation" which may be sensitive or not. This option can provide better performance for case-insensitive filters. For AnalysisFilter with DataLayer.ActiveSQL and SqlCompareFilter, the default is "DataSourceCollation". The default is "True" for all other elements.
CompareType
NotInList
InYear
InWeek
InQuarter
InMonth
InList
InDay
>=
>
=
<>
<=
<
(Required) Defines the type of comparison to perform.
CompareValue
UserDefined
The value to use in the comparison. When working with dates, to ensure they are not in an ambiguous format, specify values in y-m-d order.
DataColumn
UserDefined
(Required) The name of a data field/column returned from the DataLayer.
DataType
Text
Number
DateTime
Date
Boolean
Specifies the type of data present.
ID
UserDefined
(Required) 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.



PARENT ELEMENTS

Click element to drill down for more information.

Sql Condition Filter


CHILD ELEMENTS

Click element to drill down for more information.



 Back to top