Duplication problem

0
Hello Mendix community On the following page, I call information from an external API. When I press the button fetch activities a microflow is called and activity information is filled. As you can see there are in total 23 different activities. But when I press Fetch activities again, the data is duplicated and 23 activities are fetched again. Resulting in a total of 46 fetched activities. But I don’t want this duplicate data. So my question is how can I solve this problem? I have tried everything I know but it didn’t work. I want the following to happen: Once I press the fetch activities again the second time, I want it to give an error message saying, you have already fetched activities My microflow looks like this:       Thank in advance
asked
4 answers
1

I am assuming you have only one Activity entity where you are storing all your records. You can do the following

After the REST call, you can retrieve the whole list of Activity from the database and subtract it (using list operation) from the list returned by the REST call. After that you will only be left with items which are new. You can process those remaining items the way you want.

REST Response List – Retrieved List From DB = List to be processed

 

answered
0

@Shreyash Mehta,

i tried what you told me but i still get duplicates when I press the fetch activities button twice

this is how my microflow looks like right now:

this is how my domain model looks like:

answered
0

Hey folks,

   Correct me, if I am wrong.  What I am thinking is, When we fetch data using REST API call. It stores the returned data in a object, String variable or List. Right ? Is this objects or list will create new object GUID or not ? If think so, then while we doing list operation, it will consider our object GUID to identify the unique object. Right ?

answered
0

We can try a workaround for this can create a non persistable entity associated to Activity entity * to *. The place where the button for Rest service that one supposed to be under the helper data view. Helper can create on page load using data source microflow. Rest service microflow will look like follows. Once Rest Service return data associate with helper and in page try display data from association. Hope this would help.

answered