I have two lists with different structures i.e List1 has 10 columns and list2 has 20 columns,
What i want to do is to append list2 to list1 one with a purpose of generating a CSV file.
Can anyone assist me with a solution?
Hello Nkosikhona Ndimande,
Merging straightforward one list into another is not possible when the structures of the lists are different (which is your case). However, if the fields of one list can be mapped onto the fields of another (which seems your case), you can iterate over the second list using a "For Each" loop and use "ListAppend" to add each record, mapping the fields from the second list into the first list, or vice versa.
In cases where neither structure can accommodate the other list, my suggestion would be to create a new structure and a new list. Then, using a "For Each" loop, you can add each record to both lists using "ListAppend".
You can check/look a similar example marked a solution in this post:
Best regards,
Ana
Hello Nkosikhona,
You can use ListAppendAll with list2 (having 20 columns) and mapped your fist list columns to it.
Let me know if you need more clarity on it.
Hi @Narendra Maheshwari
The list with 10 columns must be the first line of the csv file i want to generate and the records of the second list with 20 columns must come afterwards.
You can create a temporary list of type List2 and append your list1 and list2.
Hi ,
You can use for loop and List Insert for your used case. In for loop will be your list2, and in ListInsert action List will be your List1(where you want to append data of list2), in position bind it to length of list1, by this you will be able to insert your list2 data after the list1 data ends. Hope this helps.
Please check the attached Oml, I have created one server action and appended the list variables.