Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Kilian Hekhuis
MVP
385
Views
8
Comments
"nested recursive Structure data type definition"
Question
I need a record list of structure that contains, amongst others, a record list of the same structures. But when I define it the most intuitive way (adding an attributre of data type record list, with the struct as record definiton), I get the error of this post's subject. Is there a way to define something like that?
Miguel Seabra Melo
Hi Kilian,
The OutSystems language does not allow the creation of structures that, at any depth, include attributes of that very same structure (be they Record or RecorList attributes). The only way to make this sort of inclusions is to duplicate the structure and on the "inner" version of the structure remove the offending attribute (i.e. the one that would cycle back to the "outer" structure).
Although you will effectively be working with two different structures, the
Auto Assign
funcionality between structures with the same attribute names makes it easy to "convert" between the two.
Hope this helps,
Miguel
Kilian Hekhuis
MVP
Hi Miguel,
The problem is that I need a tree with an undefined depth, otherwise I could indeed use different structs. But if it's not possible with the Platform, I'll have to resort to different measures (e.g. add a "Depth" atrribute and store everything in the same record list).
Thanks,
Kilian
Thirupathi Rao Veerla
Even I am looking for the same hierarchiecal data storage in structures with infinite depth. Any workaround to make this possible?
Kilian Hekhuis
MVP
Hi Thirupathi,
Unfortunately this isn't possible. The technical story is that the platform always initializes all of the attributes of a structure, and if it were the same structure, it would endlessly try to initialize. So no luck there!
Thirupathi Rao Veerla
Thanks Killian, how did you solve in your application? just wanted to check whether it fits to my application as well.
Kilian Hekhuis
MVP
Hi Thirupathi,
I solved it by including a Depth or Level attribute which is an integer and specifies the depth/level within the tree. It's not ideal, but it gets the job done. So if you would have something like this:
root
+--- child1
+---- child1_1
+---- child1_2
+--- child2
You'd represent it as:
root 0
child1 1
child1_1 2
child1_2 2
child2 1
Thirupathi Rao Veerla
Ok Thanks Killian, In my case, i am getting response from third party web service and XMLRecords have to deserialize to structures. I dont have control over that.
Thanks,
Thiru
Kilian Hekhuis
MVP
Hi Thiru,
Yeah, then you're basically screwed :). Having recursive structures in XML sucks. I guess you can use the XML extension i/o the XMLRecords extension to walk through the response, but it ain't nice...
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...