How do I create a dictionary from two variables?

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

Parents
  • /*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
    )
    )
    )
    )
    )

        )
      

Reply
  • /*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
    )
    )
    )
    )
    )

        )
      

Children