Skip to main content
New Participant
January 27, 2021
Question

appending a data from one dictionary to other

  • January 27, 2021
  • 1 reply
  • 0 views

i need to append the dictionary in the left pic with the list of text strings mentioned in the right pic. First dictionary should have title:task Name appended after id and 2nd dictionary should have title:Due Date after id. once when first 7 in the dictionary is appended with the values from  list of text strings, the 8the value in dictionary should start to append from 1st again in the right pic. i tried looping using foreach but it never worked. Any help would be appreciated. 

1 reply

danny.verb
Brainy
January 27, 2021

First thing to do is include the Dictionary manipulation plugin functions https://community.appian.com/b/appmarket/posts/cdt-manipulation you can do this from the admin console on your site. Then you'll still each a forEach loop

a!localVariables(
   local!dictionaryList: {
      {
        displayValue: "hello",
        id: 1
      },
      {
        displayValue: "world",
        id: 2
      },
      {
        displayValue: "earth",
        id: 3
      }
   },
   local!titles: {
     "titleOne",
     "titleTwo",
     "titleThree"
   },
   a!foreach(
     local!dictionaryList,
     updateDictionary(
       fv!item,
       {
         title: index(local!titles, fv!index, null)
       }
     )
   )
)

If you don't want to use the dictionary plugins (But you should) then you can also recreate the dictionary in the forEach