Welcome to the IDIOM Decision Products Knowledgebase.

alt
 



Recent Comments

    Positioning to an Effective Element in a Collection using ‘Look Ahead’

    Mark Norton  3 December 2009 01:05:13 PM
    A common example of this type of problem is finding an effective dated element within a collection.

    In this example case, we are looking for the most recent ‘Member Record’ that immediately precedes a 'current Period'. Note that there may be elements before and after the correct effective dated element.

    Here is the outer construct on the formula root. If we find our target effective dated element, then we will return ‘true’, else ‘false’:

    Image:Positioning to an Effective Element in a Collection using ‘Look Ahead’

    To find the effective element, we will position to an element that  a) has an effective date that is less than the current Period, and b) is either the last element in the collection or immediately precedes an element that is on or after the current period start date. We need to find an element that precedes the current period, and then 'look ahead' to see if the next element is on or after the period start, or is absent - in either case, the record that we are currently position on satisfies the effective date selection criteria.

    To execute the ‘look ahead’ we use another ‘PositionToNode’ that positions to the current Index plus 1 (ie the next element in the collection) as per the following (this expanding from the ‘AllOperationsTrue’ above).

    Image


    Image