153
Views
2
Comments
Populating Nested Structures from a Query
Discussion
Is it possible to populate a structure that contains another structure nested within it from an Advanced Query or even a Simple Query, peferably without using an Action?

For example to return the structure Orders that contains the structure Line Items.

At the moment the query is demanding an array to populate the nested structure.
Are there any examples available?

Thanks 
Charles
2014-02-13 13-39-12
Nuno Roxo
Hello Charles,

First of all, sorry by the late response.

Unfortunatelly is not possible to use nested structures in the output structures of the queries, so you'll need to develop some logic based on 'for each'.

You can check two examples here, and you can check the logic on the attached module.

Version 1 it is better than version 2, because you're doing only one query instead of doing one query inside the 'for each', that is not recomendable (in you case, if you have a huge number of orders, and each order has a huge number of line items, you can have performance issues).

Please, if you have more questions don't hesitate, we are here to help you!

Thank you!

Best Regards,

Nuno Roxo
NestedStructures.oml
2021-05-05 07-35-47
Vera Tiago
Staff
Hi 
I had the same issue a few weeks ago... and the solution was similar. 
1st - Query 
2nd - Foreach to iterate and populate the nested structure

cheers,

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.