Copy data from non-persistent to persistent entities

  Dear all, I’m trying to copy my non-persistent entities into persistent ones. I’ve got a list view where the data source is a microflow, which is doing the following operations: get the non-persistent list from HANA (first three actions); retrieve the persistent entity from database (fourth action).     This works but with a big problem. In the list view I just get a lot of duplicates from my HANA table. In other words, if in my HANA table I have just two records, in the list view I can see only the first record repeated many (probably hundreds or more) times. Thanks
3 answers

Maybe this wil work.
1:- Create a new List (<NewList>) in the beginning of your microflow;

2: Loop over the non-persistent list from HANA (= ListOfQueryUser);

3: Use List operation “Find” within the loop to find out whether the iterator Object is already added to the <NewList> (based on its key).
  If so, continue.
  If not, add the object to the <NewList>.

Use this <NewList> to retrieve the persistent entity from database. 



What exactly happens in the third and fourth action? Because if the third action does nothing but retrieve non persistent objects, why is it used at all, since the fourth action does a database retrieve and pass this list as end result. Are you sure the third action doesn’t create any objects? Or how is the list otherwise used to retrieve objects in the fourth action?

If you really need to retrieve the most actual data every time the list view is opened/refreshed, think about you do with the existing data: delete or update, instead of just adding.

Ideally you would split these actions, so a separate (scheduled event perhaps) action that retrieves and processes the data from hana, and have the above Datasource microflow only retrieve the data that is present in your mx database. Not only would this reduces the loading time of the list view for your users, it allows you to have greater control over (the quality of) your data 


Not sure why you have duplicates, you'd probably should try not to retrieve duplicates from HANA in the first place.

Easiest way for now, would be to filter the T_QUERY_USERLIST so it only contains unique values. you can do this by using the list operation intersect. Just intersect the list with itself and the result wil be a list with distinct values.