Skip to main content
January 17, 2022
Question

set local!value to multiple row

  • January 17, 2022
  • 3 replies
  • 0 views

local!a;type!table(),

local!b:{a,b,c}

local!c:{1,2,3}

a!save(target:local!a.column1,values:local!b).

a!save(target:local!a.column2,value:local!c).

why my return on local!a only has{column1:a,column2:1}

where the other two rows go?

    3 replies

    harshitb6843
    January 17, 2022

    Hi there,

    With the looks of it, you are trying to save array values in two fields of a CDT. To verify that you have the correct configurations, can you please check and tell me if your column1 and column2 in the CDT are marked as array? 

    richardm900458
    January 17, 2022

    absolutely correct  :) had the same first idea :) 

    peter.lewis
    Employee
    January 17, 2022

    In general this won't work because you're mixing types. The original type is a single CDT and you're trying to save a list of text / integer into one of those fields. But not only that - even if your original type was a list of CDT, this still won't work - you will end up seeing the first value only. In general I suggest doing a different method: using a!forEach() to exactly format the results that you want. Something like this would work:

    a!localVariables(
      local!a,
      local!b:{"a","b","c"},
      {
        a!buttonArrayLayout(
          buttons: a!buttonWidget(
            label: "Blah",
            saveInto: a!save(
              target:local!a,
              values: a!forEach(
                items: local!b,
                expression: a!update(
                  'type!Case'(),
                  "assignee",
                  fv!item
                )
              )
            )
          )
        )
      }
    )