Skip to main content
prajwalp
April 4, 2024
Solved

Want to update multilevel Dictionary

  • April 4, 2024
  • 3 replies
  • 0 views

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

    Best answer by mathieud0001

    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
    April 4, 2024

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

    prajwalp
    prajwalpAuthor
    April 4, 2024

    it is stored in a local variable,

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

    mathieud0001
    April 5, 2024

    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
        )
      )
    )