Using Conditions in DIM Projects

Using Conditions in DIM Projects

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: 
  1. Numeric Literals - numeric values and use only numbers and punctuation associated with numeric values (i.e. period (.), negative symbol (-), etc.).
    1. Examples: 3.14, -5
  2. String Literals - combinations of alphanumeric values and use single quotes ‘ ' to signify this type.
    1. Examples: 'blah', ‘User1’
  3. Value References - Region Names, Row Names, Header Names, or Internal Variables, and all use braces {} to signify this type.
    1. Examples:  {Page1@Date}, {referenceNumber}

Region Names, Row Names, and Header Names return a String if defined or Null if not defined.

Internal variables return whatever Data Type the variable has associated with it. See the article on Keywords Available for DIM Projects for details on internal variables.

Operators are needed to find a True or False result when evaluating the literals in an expressions.

Available Comparison Operators:

  1. Less Than: <
  2. Greater Than: >
  3. Less Than or Equal To: <=
  4. Greater Than or Equal To: >=
  5. Equal To: ==
  6. Not Equal To: !=
Available Logical Operators:
  1. AND: && (Logical And)
  2. OR: || (Logical Or)

Precedence (Highest to Lowest) for Operators:

  1. All Comparison Operators
  2. Logical AND
  3. Logical OR
When Comparison Operators are used, String Values are always converted to Numeric Values in order to easily support Numeric Comparisons. For example:
  1. {Page1@Total} < 10

{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:

  1. 0 == '0'
  2. 0 == 0.00
  3. 0 == '0.00'
  4. '0' == '0.00'

Expressions support Parentheses for more advanced comparison. For example:

  1. ({Page1@Total} – 5) < 10
When evaluating a condition in a DIM Project, the final value of the expression is interpreted as a Boolean.
  1. False, Null, and the Empty String evaluate to False.
  2. 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:
  1. condition="{Page1@Total}"


Sample Code

CSV - insert a row if Region has a value
  1. <writeCsv>
  2.    <filename>{filename}</filename>
  3.    <outputDirectory>C:\F2B Data</outputDirectory>
  4.    <csvFormat>
  5.       <header>
  6.             <field>Date</field>
  7.             <field>Supervisor</field>
  8.             <field>Employee</field>
  9.             <field>ST</field>
  10.             <field>OT</field> 
  11.       </header>
  12.       <row condition = "{Page1@Employee1}">
  13.          <field quoteMode="Auto" width="0" alignment="Left">{Page1@Date}</field>
  14.          <field quoteMode="Auto" width="0" alignment="Left">{Page1@Supervisor}</field>
  15.          <field quoteMode="Auto" width="0" alignment="Left">{Page1@Employee1}</field>
  16.          <field quoteMode="Auto" width="0" alignment="Left">{Page1@ST1}</field>
  17.          <field quoteMode="Auto" width="0" alignment="Left">{Page1@OT1}</field> 
  18.       </row>
  19.       <row condition = "{Page1@Employee2}">
  20.         <field quoteMode="Auto" width="0" alignment="Left"></field>
  21.         <field quoteMode="Auto" width="0" alignment="Left"></field>
  22.         <field quoteMode="Auto" width="0" alignment="Left">{Page1@Employee2}</field>
  23.         <field quoteMode="Auto" width="0" alignment="Left">{Page1@ST2}</field>
  24.         <field quoteMode="Auto" width="0" alignment="Left">{Page1@OT2}</field>      
  25.       </row>
  26.    </csvFormat>
  27. </writeCsv>
    • Related Articles

    • Data Integration Module (DIM) User Guide

      Overview The Field2Base Data Integration Module allows you to automatically download data from your Sent Forms to your backend systems. The DIM provides transformation of your Form Data into a variety of formats including CSV and SQL. The DIM Sample ...
    • Additional Project Options Not Available in the DIM Project Manager

      Overview The Field2Base Data Integration Module does have some Project features that can be added by directly editing the Project XML file with a Text Editor. Most of these features are advanced or not often used options and were not included in the ...
    • Troubleshooting the Data Integration Module (DIM)

      Troubleshooting Installation Issues User Account Privileges If you encounter any Permission related issues when installing the Data Integration Module, you will need to check and make sure that you have Administrator rights so that the Program AND ...
    • Data Integration Overview

      Our paperless mobile platform drives your digital transformation. A part of how we accomplish this is through our robust integration solutions designed specifically around your business and existing systems. Field2Base offers complete data ...
    • DIM Sample Project Walkthrough Guide (CSV Output)

      Overview This document walks through the setup of a CSV output Sample Project in the Field2Base Data Integration Module (DIM) software.  Reference Files & Folder Setup  Note: This document assumes you have already installed the latest version of the ...