Skip to main content
vijaykumars5676
March 28, 2023
Question

Dictionary operations

  • March 28, 2023
  • 2 replies
  • 3 views

I have to local variables as input

1. List of dictionary : [ [ id:1,value:"abc" ] , [ id:2,value:"bbb" ] , [ id:4,value:"ccc" ] ]

2. List of integers: [1,4]

 I want to create 3rd local variable (List of values) by selection value from dictionary where id is present in the List of integers 

example : 

result ->    List of values : [ "abc","ccc" ]

    2 replies

    March 28, 2023

    a!localVariables(
      local!dict: {
        { id: 1, value: "abc" },
        { id: 2, value: "abcde" },
        { id: 3, value: "pww" }
      },
      local!intArr: { 1, 3 },
      index(
        local!dict.value,
        wherecontains(
          tointeger(local!intArr),
          tointeger(local!dict.id)
        ),
        null
      )
    )

    subhad
    Participating Frequently
    March 28, 2023

    Hi Vijaykumar,

    Try the below code,

    I would suggest you to go over the Appian functions which I have mentioned in the snippet

    a!localVariables(
    local!list: {
    { id: 1, value: "abc" },
    { id: 2, value: "bbb" },
    { id: 4, value: "ccc" }
    },
    local!index: { 1, 4 },
    index(
    local!list.value,
    wherecontains(local!index,tointeger(local!list.id)),
    null
    )
    
    )