Merging non-persistent objects - best approach? - Mendix Forum

Merging non-persistent objects - best approach?

0

I have 2 non-persistent objects which I need to merge, e.g.:

object 1: 

{

“data1”: “….”

}

 

object 2:

{

“data2”: “...”

}

 

What are the pros and cons of the different ways to merge these objects? I see two options:

 

  1. Model one of the objects as having both fields and perform a ‘Change object’ activity, copying e.g. “data1” from object1 to the empty “data1” field of object 2.
  2. Model a 3rd object which has all fields, perform a ‘Create object’ activity, setting the values of the fields from the two objects

 

I will be merging a list of these objects, so if one method has drastically different performance to the others, that would be preferred. 

asked
2 answers
0

The final merged object will be displayed on a page (Datagrid + AnyChart – essentially, one of the objects contains some chart data and the other object some metadata. I’d like the chart to ‘listen’ to the selection of the data grid, which will display metadata – hence the need to merge the objects)

 

So, essentially, these objects are not editable (by the end user) and this is the final thing that will happen to them (in terms of microflows)

answered
0

Hi James,

I’d say the answer depends on what you want to do with the resulting object(s), what is the situation? 

In any case, the first option results in less objects so that’s probably preferable, you can also delete/clear the object(s) you don’t need anymore

answered