Skip to main content
prajwalp
New Participant
Apr 4, 2024 7:27 PM UTC
Solved

Want to update multilevel Dictionary

I want to update milestones with a new list of dictionary. Is there any way to do that? 

    mathieud0001
    Genius
    Apr 5, 2024 12:02 AM UTC

    a!localVariables(
      local!map: a!map(
        success: true,
        statusCode: 200,
        body: {
          cobMstrld: "CONB100227",
          onBoardingStatus: "IN_PROGRESS",
          milestones: { { id: 1 }, { id: 2 }, { id: 3 } }
        }
      ),
      local!body: local!map.body,
      local!updatedMilestones: { { id: 4 }, { id: 5 }, { id: 6 } },
      a!update(
        local!map,
        "body",
        a!update(
          local!body,
          "milestones",
          local!updatedMilestones
        )
      )
    )

    3 replies

    mikes0011
    Brainy
    Apr 4, 2024 7:31 PM UTC

    Where is this stored?  Under what context will it be getting updated?  What have you tried?

    The Expression Guru
    prajwalp
    prajwalpAuthor
    New Participant
    Apr 4, 2024 7:33 PM UTC

    it is stored in a local variable,

    and the milestone data is unsorted, so i created a new list of sorted data.

    mathieud0001
    Genius
    Apr 5, 2024 12:02 AM UTC

    a!localVariables(
      local!map: a!map(
        success: true,
        statusCode: 200,
        body: {
          cobMstrld: "CONB100227",
          onBoardingStatus: "IN_PROGRESS",
          milestones: { { id: 1 }, { id: 2 }, { id: 3 } }
        }
      ),
      local!body: local!map.body,
      local!updatedMilestones: { { id: 4 }, { id: 5 }, { id: 6 } },
      a!update(
        local!map,
        "body",
        a!update(
          local!body,
          "milestones",
          local!updatedMilestones
        )
      )
    )