Bug Appian 18.2 SaveInto doesen't accept array

Hi all,

In previous Appian Version 17.2 is possible to insert an array in the saveInto Expression of a field (See below Sail)

 

saveInto: {
ri!gridSelection,
if(
rule!APN_isEmpty(ri!gridSelection.selected),
a!save(
ri!titoliSelezionati,
{}
),
a!forEach(
items: {ri!gridSelection.selected},
expression:
if(
rule!APN_isBlank(wherecontains(tostring(fv!item), ri!titoliSelezionati.idCodBene)),
{
a!save(
ri!titoliSelezionati,
append(
ri!titoliSelezionati,
ri!data[wherecontains(tostring(fv!item), ri!data.idCodBene)]
)
),
a!save(
ri!titoliSelezionati.vendita,
"Parziale"
),
{}
},
a!save(etc..)
)
)
}

 

now in 18.2 doesen't accept the array of a save in the a!forEach expression and it is necessary to use the a!flatten function to avoid the error.

 

Does anyone has experienced this bug? Is a Bug? There will be an hotfixes in future relaese?

 

Thanks

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Whether or not this is a bug, I don't think using an a!forEach is even necessary in the code you provided.

    There's no reason to be executing

    a!save(
        ri!titoliSelezionati.vendita,
        "Parziale"
    )

    for each item in the list of selections, since you're just saving the same value over and over.

    The forEach also looks like you're rebuilding an entire list (ri!titoliSelezionati) from scratch each time someone selects a new item in the grid. Although this might be easier, an arguably better approach is to figure out which item was added/removed and then do the processing on that item alone. You can do this by comparing your existing list (ri!titoliSelezionati), with the new list (save!value). This would improve the scalability of your solution, if that is a concern.

Reply
  • 0
    Certified Lead Developer

    Whether or not this is a bug, I don't think using an a!forEach is even necessary in the code you provided.

    There's no reason to be executing

    a!save(
        ri!titoliSelezionati.vendita,
        "Parziale"
    )

    for each item in the list of selections, since you're just saving the same value over and over.

    The forEach also looks like you're rebuilding an entire list (ri!titoliSelezionati) from scratch each time someone selects a new item in the grid. Although this might be easier, an arguably better approach is to figure out which item was added/removed and then do the processing on that item alone. You can do this by comparing your existing list (ri!titoliSelezionati), with the new list (save!value). This would improve the scalability of your solution, if that is a concern.

Children
No Data