Save only updated data from a given array

Certified Associate Developer

Hi All,

I have a query if we have two array one is local!finalGridData and second one is local!origionalData.

In the local!finalgridData i have updated data 

local!finalGridData containing data like-

1. id:1, enddate: 21/01/2025 , 

 id:1, endDate: 20/01/2025,

id: 1, endDate: 19/01/2025

2. id:2, enddDate: 17/01/2025,

id:2,enddate:15/01/2025

local!origionalData containing data like-

local!finalGridData containing data like-

1. id:1, enddate: 15/01/2025 , 

 id:1, endDate: 16/01/2025,

id: 1, endDate: 14/01/2025

2. id:2, enddDate: 17/01/2025,

id:2,enddate:15/01/2025

now we can see in local!finalGridData i have some updated data with endDate , but it also have data for id:2 which is not updated.

so i want to fetch only updated data from local!finalGridData .

 in this scenario id:2 data is not updated but in some cases it will update if user updated the date from UI .

if both ids data updated then it's ok to send all the data but if not for all ids then i have to send only updated data in submit button.

so please anyone can help me on this.Thanks in advance

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    Hi ,

    i have tried this, but it's not working 

    a!save(local!test,
    a!forEach(
    items: local!finalgridData,
    expression: if(
    fv!item.endDate=index(local!originalData.data,
    wherecontains(touniformstring(fv!item.endDate),
    touniformstring(local!originalData.data.endDate)),{}).endDate,
    remove(fv!item, index(local!originalData,
    wherecontains(touniformstring(fv!item.referenceNumber),touniformstring(local!originalData.data.referenceNumber), ),{})),
    fv!item

    )),



    )

Children