I have an array from which I am obtaining the date field:
local!weeks: index( ri!casualWorkSchedule, "weeks", {} ),
I then have a second variable for hours on which I do a calculation on the passed array:
local!proposedHours: tointeger( a!forEach( items: ri!casualWorkSchedule, expression: rule!CAT_calculateProposedHoursFromCasualWorkSchedule(tempWorkSchedule: fv!item) ) ),
From these two variables I wish to create a dictionary such as:
Any suggestions on how this may be achieved would be appreciated.
Thanks
Irene Best
Discussion posts and replies are publicly visible
Further to my question above, you may wish to know what I am attempting to do.
Basically, I need to calculate if the total hours for a week are greater than 36.75.
Already allocated hours are sourced from a view. Hours being assigned are sourced from a process variable as they are not stored until the process is completed. A warning needs to be displayed prior to the process completing for allocated hours + proposed hours > 36.75.
The total hours is already calculated in the view. The proposed hours need to be calculated by summing each (pay code hours X sessions) where the paycode and sessions are input by the user and stored in a process variable.
This is per week where there may be many weeks.
Just for some clarity on what I am trying to achieve
Please check https://docs.appian.com/suite/help/20.3/fnc_system_map.html and docs.appian.com/.../Expressions.html
/*create a cdt with three fields id, weekEndingDate, totalHours and then use that cdt . i have attached a workable code just you need to replace the cdt name with your created cdt. Please do null handling for ri!casualWorkSchedule*/
local!weeks: index( ri!casualWorkSchedule, "weeks", {}),a!flatten( a!forEach( items: ri!casualWorkSchedule, expression: type!cdt( weekEndingDate: index( local!weeks, fv!index, null ), totalHours: tointeger( rule!CAT_calculateProposedHoursFromCasualWorkSchedule( tempWorkSchedule: fv!item ) ) ) ))
)
Thanks very much for this.