Home > FAQ > Data Manipulation > Event histories (status histories) > Creating a start event dates array (StartEventDates)

Creating a start event dates array (StartEventDates)

When working with an event history in an expression, it often makes the expression much simpler (and easier to understand) if you create an effective date array to hold all the start event dates, e.g., StartEventDates.  

For example, something like (#DATE >= StartEventDates) #AND (#DATE <= StopEventDates) can be very useful.

First, you need to create an effective date array field in the Data Dictionary to hold the start event dates (e.g., StartEventDates).

Now, create a Data Default for StartEventDates (always apply the default) using this expression. This expressions assumes that the event history is in a coded effective date array called EventHistory and that the only start event codes are 10, 11, and 12.  

Eff_DT:= #START EventHistory &
Code:= #VALUE EventHistory &
IsStartEvent:= Code #IN (10,11,12) & ; i.e., #IN (all the start event codes)
 
12 #ARRAY (Eff_DT * IsStartEvent, Eff_DT)
; (1) #ARRAY always drops rows with a zero effective/start date from the final array
; (2) All the effective dates for stop events have been multiplied by zero (see
;     IsStartEvent), so #ARRAY will drop them from the final array, leaving just
;     start event dates in the final array