Welcome to the IDIOM Decision Products Knowledgebase.

alt
 



Recent Comments

    Positioning to an Effective Dated Record in a Collection

    Feargus Norton  3 February 2010 02:44:34 PM
     

    Friday, October 30th, 2009
    This example sets a flag to mark an element in a collection that matches the effective date criteria. Note that other criteria can be included by ‘anding’ the additional criteria along with the date selection. See the example below.

    The approach uses an ‘AllOperationsTrue’ (anded) operation that finds a potentially complying record – which is one that is LessThanOrEqual to the required date – and then ‘looks-ahead’ to the next record to see whether it is forward (GreaterThan) of the required criteria, or not present, in which case a high-values result is returned. Provided that the records are in date order (they can be sorted if this is not assured) then this finds the closest record that is immediately before or at the effective date regardless of the number of elements present in the collection.

    Note that the PositionToNode operator is indexing directly to the next Element in the collection.

    Image


    This formula is trying to find the record that is closest or on the adjusted start date, and can be paraphrased as: find a node in the collection that is earlier than or on the adjusted start date, and if the next record is later than the adjusted start date OR there is no next record then return true (this node is the effective node).

    The 'Logical English' generated for this formula is as follows:

    The Formula Version "@IsStartOfPeriodIN" is defined as follows.
     

    Perform the following series of tests. This operation will return true only when ALL tests in the series are true:  

    The first test will return true when effective date <= adjusted start date
    The second test will return true when A > adjusted start date

    A: The result of the nominated operation, after moving the context to the list of member profile history(s) and positioning to the node indicated by the index selected below:  
                    The sequence number of the current node + 1
    The operation to perform on the indexed node is:  


    Return the value of effective date





    and if the collection is empty, or the index is out of bounds, return "1/01/2999 12:00:00 a.m."