Skip to main content
September 30, 2021
Question

for a list it return all value, but if i add attribute under it, it just keep return multiple value of the list first value

  • September 30, 2021
  • 4 replies
  • 0 views

As pictures show, i wish to save all list of value to database, but once i add attribute under it, it one keep returning value of the list's first value, why? Is this the defect of appian software it self?

    4 replies

    September 30, 2021

    hello, hope this help [emoticon:c4563cd7d5574777a71c318021cbbcc8]

    The target parameter accepts a list of variables, in this case you are wrongly passing all the current ids of your rule input variable (2000,2001,200), instead pass them one by one
    in order to make it work you must perform the save as follows

    a!forEach(
    items: ri!csetenderphases,
    expression: a!save(
    fv!item.id,
    /*just an example, find out the right index for the local list*/
    index(
    local!csetenderphaseslist,
    fv!index,
    null
    )
    )
    )

    September 30, 2021

    Alternate way to avoid any loops is to use updateCdt() function. Just use updateCdt to update fields/CDT attributes that do not have direct mappings  before saving them into your rule input. For instance based on your screenshot seems like only (.user) attribute is set from another local but other attributes are directly mapped, so in this case code snippet be like -

    a!save(
      ri!csetenderphases,
      updatecdt(
        local!csetenderphases,
        {
          user: repeat(count(local!csetenderphases), local!newUser)
        }
      )
    )

    October 8, 2021

    could you give a detail version of this? looks like a new idea, i don't know what to write in updatecdt, always failed to try