655
Views
5
Comments
Update the data in list variable

Hello All,

I have a list variable which contains the data that needs to be updated. I have a structure that contains the updated data. How can I update the contents of a list with the data present in the structure.


For eg. I have a table named TABLE 1. I have a list variable whose datatype is List of Table1. This list variable contains all the data that needs to be updated. I have a Structure which contains all the updated data.


Now, can anyone please tell me how to update the list variable with the data of the structure. 


Everytime the server action for updating the data is called, the data in list variable also changes and the updated data also changes according to the filters applied. It is done in reactive.

2019-07-01 07-16-04
Vinod Patidar

Hi Runisha,

Please follow the below steps to update the list from structure on client side. Please find the attached sample OML as well.

1. You need to iterate list first. For that you can use for each widget.

2. You need to compare list current item with your structure. 

GetProducts.List.Current.Sample_Product.Name = ProductStructure.Name

3. If condition is true update the current list with structure data.


4. If your structure is list type then you can use ListFilter client action that is available in System.


Thanks

Vinod

ListSample.oml
UserImage.jpg
Runisha Rajkhowa

Hello Vinod, thank you for your solution. But, can you suggest me how to do the same thing through server action.

2019-07-01 07-16-04
Vinod Patidar

Hi Runisha,

You need to write same logic in server action. You need create a server action with input and output parameter. Please see the below screen. Write the same logic as mentioned in previous comment. In last assign updated list to the output parameter.


Thanks

Vinod

2023-12-14 09-56-57
Yogesh Javir

Hey,

The simplest way is.
If you have list of table and structure with updated data then follow below step

In action, 

  1. Add loop on list variable
  2. Use list filter in loop cycle to check id from structure is present in list or not(ex.condition for listfilter is list1.current.id=structure.id)
  3. If listfilter return result as true, it means item is present in list.
  4. Add if to check listfilter output as true or false, if true then in true flow add assign and change value of current record of list in loop.
  5. Join false to foreach loop to check next record.

Hope this will help you.

Thanks

Yogesh Javir

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Not adding to the possible solution already shared by others, but having a question. Why do you want to update the list if it is populated from the database? Is it because you cannot retrieve a particular value and need to calculate it?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.