Self Reference in microflow

1
Dear colleagues,   i have a very specific problem in a microflow. I want to build a tree structure (parent-child association) with object of entity component: In this case components already have a self reference in the data model and are associated to an order item. Everytime i create a new object component i have to go through the list of already existing components and look for the last object which has a lower structure number.  For example: i create a component with structure number 4, therefore i need to look for the last object with structure number 3 in the list and set the assoication. My first idea was to add an autonumber attribute so i can identify each object... I would really be happy about an easy solution!   Max   
asked
2 answers
2

Hi Max,

Not sure if this solves your issue, but you can retrieve the first item from the database and sort by the Structure descending, you will then receive a single Component object with the highest numbered Structure attribute:

answered
2

I wouldn't make an autonumber because this is a number you can't control, an autonumber is automatically generated and you can also get gaps in your sequence .

What I would do is use an integer and put in the number you need.

You can easily retrieve the last object (the one with the highest number). You create a retrieve from database and in it retrieve the "First" object. If you then sort that retrieve descending on the attribute "Structure" then you have the object with the highest number.

answered