Search code examples
nxbre

NxBRE - Date Validation with the Flow Engine


How to compare a date in .xbre rule file.

For example, I have the rule below:

<ObjectLookup id ="EmpObj" objectId ="EmpLvl" member ="JoinDate"/>
 <Logic>
    <If>
      <And>
        <Between leftId ="2009-10-10" rightId ="2010-10-10" valueId ="EmpObj">          
        </Between>
      </And>
      <Do>
        <Modify id ="LVL" type="String" value ="Sr"/>
      </Do>
    </If>
    <ElseIf>
      <And>
        <Between leftId ="2010-10-10" rightId ="2014-10-10" valueId ="EmpObj" excludeLeft ="true">
        </Between>
      </And>
      <Do>
        <Modify id ="LVL" type="String" value ="Jr"/>
      </Do>
    </ElseIf>
</Logic>

Based on the JoinDate passed, I need to get a string based on the date range. When I run the above rule, it takes the dates mentioned in leftId and rightId but does not take the date range.

How to check date range/between dates?


Solution

  • You must ensure that the types are consistent across the board, ie that your either using Strings or DateTime types in both the value tested and the boundaries used in Between.