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>
    • Popular Articles

    • Forms Designer Quick Start Guide

      Overview Field2Base Forms Designer is the proprietary software application that allows your existing paper forms to be quickly converted to a smart E-form available to your end users via our mobile and web-based Mobile Forms applications. This ...
    • Portal 11.28.2023 Release Notes

      Overview Our release notes offer brief descriptions of product enhancements and bug fixes. We include links to the current articles for any affected features. Those articles will be updated shortly after the Portal release to include new ...
    • Integration Service Configuration Guide

      How To Configure Integration Services To Allow Read/Write Access on a Network Path All of our Integration Products, including the DIM, DUU, and EDM have respective Windows Services responsible for communicating with our server. Occassionally, ...
    • Data Integration Module (DIM) Migration Guide

      Overview This article provides the information necessary to migrate the Field2Base Data Integration Module (DIM) over from one server to another. Please refer to the DIM Install Guide for the initial installation of the Field2Base DIM. Once that's ...
    • How to Check the Version of Integration Products Running on a Windows 10 Machine

      Right-click on the Start menu button. Click on Apps & Features. In the Apps & Features search bar type in the Integration Product you are looking for, eg. F2B Data Integration Module, F2B Data Upload, or F2B Enterprise Dispatch Module. Click to ...