Multiple events on the same day
The first thing ProAdmin does to arrays, is to sort them by date in descending order. If you have two rows in the array with the same date, you can't be positive which value "actually" came first (it's a function of the data source and the tool used to retrieve the data). The basic rule is ... you can't be sure in what order the rows were created in the database.
This is true even when you define an array in the Data Dictionary, and ask to return the "most recent value". It is possible if the most recent date has 2 values, then one time one value will be returned, and the next the other value will be returned (unlikely, but possible).
With effective date and start/stop date arrays (e.g., hours, salaries, rates of pay, events), you can see the separate values in a data default (they just have the same dates), but in transformation expressions (or formulas) all values with the same effective or stop date are added together. This includes event codes; they will be added together. So, it's important to eliminate at least one of the events (or account for the summed codes in your data dictionary array field codes).
This makes it very tricky when dealing with events with the same effective dates because you don't want those coded values added together: you can only look at all the values with the same date in a data default expression, and try to use the values (e.g., event codes) to determine which events to keep, drop, or create a new code.
If we wanted to drop all events with the same date, then we could do something like this:
EV_DT:= #START EventHistory &
Code:= #VALUE EventHistory &
DropEventsWithSameDate:= (EV_DT = ('N' #GETASOF EV_DT)) #OR (EV_DT = ('P' #GETASOF EV_DT)) &
; If the current event date is the same as the next event date, or the current event date
; is the same as the prior event date, then drop all events with the same date.
12 #ARRAY(EV_DT * #NOT DropEventsWithSameDate, Code)
; (1) #ARRAY always drops rows with a zero effective/start date from the final array.
; (2) All the effective dates for events with the same effective date have been
; multiplied by zero, so #ARRAY will drop them from the final array
Multiple events on the same day can be a very tricky to handle for calculation purposes. If this is a situation you are dealing with, please call the ProAdmin Support line to discuss options.