I'm trying to copy all records from an entity to an empty entity using the ListAppendAll action. The set-up below does create one record (out of thousands) that are in the source list. The only thing special I needed to do in the action set-up is convert the source identifier to the destination identifier, and I did this by using a function to convert the source identifier to an integer and then the result to the destination identifier. Any suggestions on why all records are not being appended? An example OML would be great.
SyntaxEditor Code Snippet
You cannot create all the thousand records in one go, you have to introduce the loop before creating the another entity for more than 1 records.
1. pass you complete list of record as source to loop.
2. within loop use the create entity action and it will iterate 1000 times for creating 1000 records.
Manish Jawla wrote:
Thanks Manish, just to be clear I have one existing entity with data and a second existing entity (with the same meta-data) with no data. I simply want to copy all data from entity one to entity two. I'm not sure why I need to use a loop for the "ListAppendAll" action since there is a "ListAppend" action that appears to require looping. What's the value of the "ListAppendAll" if it does not append all records without looping? Just trying to understand the difference and if my configuration is correct. If possible can you bullet point the correct sequence of flow actions as I've shown in the screen capture above? Appreciate your help!
Basically what ListAppendAll does is adding all elements in a list to the end of another list, but all working in memory.
This and the fact that the CreateOrUpdate only works for one record at a time, make you iterating each element and create each at a time by calling the CreateOrUpdate (not sure you'll need the ListAppendAllto perform this, but you still can use it if you want).
To know more about this action you can check the documentation here.
Your recommended approach works well, many thanks
You need to do some own logic to copy all data from one table to another table.
I have created two tables Student & StudentTest with same metadata initially Student is having records and StudentTest is blank.
Now I have written below logic to copy all data from Student to StudentTest and it is working for me.
That SQL only approach also works, sure, but typically if is an one shot process (and maybe in this case you don't need to do more than a SQL script directly in your database).
Using the platform is a good practice to use the CRUDS given out of the box because then, if you entity changes (a new attribute/change column order for example), in an advanced query you'll have to remember to change for instance the select statement with the new attribute or change the order of the columns, otherwise that operation will fail.
Using the platform methods you have that automatically given and also have intellisense to help you.
As per my understanding there are no direct method to do it in platform. If you found anything please share with us.
You don't have any out of the box method to perform mass inserts.
You can implement something similar using an extension, but to be honest, for this case I don't see the need for that. If is one shoot, use a SQL script in the database, if not use the method I mentioned.
Hope it helps,