Skip to main content
October 9, 2024
Solved

I have list of map want to convert it into single map

  • October 9, 2024
  • 3 replies
  • 0 views

i have this {a!map(memberId: "test ui "), a!map(holdReason: "test ui "), a!map(description: "test ui "), a!map(summary: "test ui ")} wants an out put like 


a!map(

memberId: "test ui ",

holdReason: "test ui ",

description: "test ui ",

summary: "test ui "

)

is this possible ??

Best answer by kumara0180

a!localVariables(
local!listOfMap: {
a!map(memberId: "test ui "),
a!map(holdReason: "test ui "),
a!map(description: "test ui "),
a!map(summary: "test ui ")
},
local!keyValuePair: a!forEach(
items: local!listOfMap,
expression: {
key: tostring(a!keys(fv!item)),
value: index(
fv!item,
tostring(a!keys(fv!item)),
null()
)
}
),
a!update(
a!map(),
cast(
a!listType('type!Text'),
index(local!keyValuePair, "key", null())
),
cast(
a!listType('type!Text'),
index(local!keyValuePair, "value", null())
)
)
)

3 replies

kumara0180
October 9, 2024

a!localVariables(
local!listOfMap: {
a!map(memberId: "test ui "),
a!map(holdReason: "test ui "),
a!map(description: "test ui "),
a!map(summary: "test ui ")
},
local!keyValuePair: a!forEach(
items: local!listOfMap,
expression: {
key: tostring(a!keys(fv!item)),
value: index(
fv!item,
tostring(a!keys(fv!item)),
null()
)
}
),
a!update(
a!map(),
cast(
a!listType('type!Text'),
index(local!keyValuePair, "key", null())
),
cast(
a!listType('type!Text'),
index(local!keyValuePair, "value", null())
)
)
)

October 9, 2024

thanks 

October 10, 2024

a!localVariables(
  local!listOfMap: {
    a!map(memberId: "test ui "),
    a!map(holdReason: "test ui "),
    a!map(description: "test ui "),
    a!map(summary: "test ui ")
  },
  a!map(
    memberId: joinarray(
      a!forEach(
        local!listOfMap,
        fv!item.memberId
      ),
      ", "
    ),
    holdReason: joinarray(
      a!forEach(
        local!listOfMap,
        fv!item.holdReason
      ),
      ", "
    ),
    description: joinarray(
      a!forEach(
        local!listOfMap,
        fv!item.description
      ),
      ", "
    ),
    summary: joinarray(
      a!forEach(
        local!listOfMap,
        fv!item.summary
      ),
      ", "
    )
  )
)