Skip to main content
May 2, 2024
Question

In array i have to update data to specific column tried using update array function

  • May 2, 2024
  • 4 replies
  • 0 views

[ld_id=1188, ll_id=904, fl_id=, fm_id=, rsed_id=, appian_document_id=5357264, klt_id=, legacy_id=, description=, name=, createdby=testc, createdon=10/3/2022 7:14 PM, modifiedby=tects, modifiedon=10/3/2022 7:44 PM, inuse=1],[ld_id=, ll_id=904, fl_id=, fm_id=, rsed_id=, appian_document_id=6057969, klt_id=, legacy_lease_id=, description=The Parties, by mutual agreement, due to the Partial Surrender of the Demised Premises, agree to amend items 1 ("Base Rent"), 3 ("Demised Premises") and 10 ("Shared Property Expenses") of the Summary of Terms and Definitions of the Agreement., name=, createdby=testc, createdon=10/3/2022 7:44 PM, modifiedby=, modifiedon=, inuse=1],[ld_id=, ll_id=, fl_id=, fm_id=, rsed_id=, appian_document_id=6057968, klt_id=, legacy_id=, description=, name=, createdby=, createdon=, modifiedby=lecst, modifiedon=10/3/2022 7:44 PM, inuse=0]

This was the pv variable cdt data in that for second id (second occurence) means where document id =6057969 i want to update "description" column data i used update array function in the place of index i was confused what exactly needs to be provided kindly suggest on this

updatearray(
array:pv!documentsToUpdateInDB,
index:index(
pv!documentsToUpdateInDB,
*tried with many ways here by passing as index not worked*
),
value:"The Parties, by mutual agreement, due to the Partial Surrender of the Demised Premises"

4 replies

daniell
May 2, 2024

The "index" parameter is just the integer index, so in your example you'd want an expression that evaluates to the number 2. The final value would be the replacement CDT (with your updated description field)

See the docs page for more info on how to use this function properly

konduruc733182
May 2, 2024

Hello [mention:d2329cbf3ade4de5b8122d425883af31:e9ed411860ed4f2ba0265705b8793d05] 

could you please try the below piece of code to evaluate and update. Please let me know if I missed something.

a!forEach(
  items: pv!documentsToUpdateInDB,
  expression: if(
    a!isNullOrEmpty(fv!item.description),
    fv!item,
    a!update(
      data: fv!item,
      index: "description",
      value: "The Parties, by mutual agreement, due to the Partial Surrender of the Demised Premises"
    )
  )
)

May 3, 2024

Hi dharanik2600,

Since you want to update a particular row based on doc id,

please try the following code,

updatearray(
array: index( pv!documentsToUpdateInDB,wherecontains( tointeger("appian_document_id"), tointeger(index(pv!documentsToUpdateInDB,"appian_document_id",null)), null),
index: "description",
value: "Text to be replaced"
)

if you are looking to update an array of elements you can use foreach on top the code.

please let me know if it works or not.

thanks

May 3, 2024

Thank you all for your suggestions