Overview
The Data Integration Module Project Manager allows the User to create Conditions on CSV and SQL Data Transformations that will decide whether or not to Output the processed data of a Job. These Conditions can be setup on each Row (CSV) or Insert (SQL). The following sections will provide an overview of using Conditions in the Project Manager Utility.
Condition Expressions
The conditions in data transformations are evaluated like basic expressions in any programming language. These expressions require a series of values be evaluated using operators and comparisons to result in a Boolean (True/False) response.
The values used in condition expressions use the following types:
- Numeric Literals - numeric values and use only numbers and punctuation associated with numeric values (i.e. period (.), negative symbol (-), etc.).
- Examples: 3.14, -5
- String Literals - combinations of alphanumeric values and use single quotes ‘ ' to signify this type.
- Examples: 'blah', ‘User1’
- Value References - Region Names, Row Names, Header Names, or Internal Variables, and all use braces {} to signify this type.
- Examples: {Page1@Date}, {referenceNumber}
Region Names, Row Names, and Header Names return a String if defined or Null if not defined.
Operators are needed to find a True or False result when evaluating the literals in an expressions.
Available Comparison Operators:
- Less Than: <
- Greater Than: >
- Less Than or Equal To: <=
- Greater Than or Equal To: >=
- Equal To: ==
- Not Equal To: !=
Available Logical Operators:
- AND: && (Logical And)
- OR: || (Logical Or)
Precedence (Highest to Lowest) for Operators:
- All Comparison Operators
- Logical AND
- Logical OR
When Comparison Operators are used, String Values are always converted to Numeric Values in order to easily support Numeric Comparisons. For example:
{Page1@Total} returns a String Value, and since the Less Than Operator has been used, whatever value (i.e. ‘20’) is converted to properly work in the Expression.
With that being said, the following examples all result to True:
- 0 == '0'
- 0 == 0.00
- 0 == '0.00'
- '0' == '0.00'
Expressions support Parentheses for more advanced comparison. For example:
- ({Page1@Total} – 5) < 10
When evaluating a condition in a DIM Project, the final value of the expression is interpreted as a Boolean.
- False, Null, and the Empty String evaluate to False.
- All other Values (including a result of zero) evaluate to True.
If you would like a condition to check whether a Region has value or not, you can just simply use the Region without any comparison logic. For example:
- condition="{Page1@Total}"
Sample Code
CSV - insert a row if Region has a value
- <writeCsv>
- <filename>{filename}</filename>
- <outputDirectory>C:\F2B Data</outputDirectory>
- <csvFormat>
- <header>
- <field>Date</field>
- <field>Supervisor</field>
- <field>Employee</field>
- <field>ST</field>
- <field>OT</field>
- </header>
- <row condition = "{Page1@Employee1}">
- <field quoteMode="Auto" width="0" alignment="Left">{Page1@Date}</field>
- <field quoteMode="Auto" width="0" alignment="Left">{Page1@Supervisor}</field>
- <field quoteMode="Auto" width="0" alignment="Left">{Page1@Employee1}</field>
- <field quoteMode="Auto" width="0" alignment="Left">{Page1@ST1}</field>
- <field quoteMode="Auto" width="0" alignment="Left">{Page1@OT1}</field>
- </row>
- <row condition = "{Page1@Employee2}">
- <field quoteMode="Auto" width="0" alignment="Left"></field>
- <field quoteMode="Auto" width="0" alignment="Left"></field>
- <field quoteMode="Auto" width="0" alignment="Left">{Page1@Employee2}</field>
- <field quoteMode="Auto" width="0" alignment="Left">{Page1@ST2}</field>
- <field quoteMode="Auto" width="0" alignment="Left">{Page1@OT2}</field>
- </row>
- </csvFormat>
- </writeCsv>