Start a new topic
Answered

What is the best way to avoid circular references in a hierarchy?

What is the best way to avoid circular references in a hierarchy? For example, in the context of a chart of account, how is it possible to exclude all children of the currently edited account in the parent drop down list?


Best Answer

Matthew Dahlman

Luc Boissonneault, Zahuur's example would handle direct children. There's no way in SemQL to handle an arbitrary depth. But you could easily adapt this to preclude grandchildren, great grandchildren... etc up to any predetermined depth.

Hi Luc,

I was able to test out your example in my environment.  I would recommend creating a picker filter in your stepper to achieve your desire result. Please follow these steps below

Navigate to the App Builder, Select your stepper then navigate to Steps > then select Reference Selection and create a Picker Filter similar to this one below to exclude the children's records.


Referenced.ID <> Record.ID AND (     Referenced.FID_ParentAccount <> Record.ID     OR Referenced.FID_ParentAccount is null )


What is the best way to avoid circular references in a hierarchy? For example, in the context of a chart of account, how is it possible to exclude all children of the currently edited account in the parent drop down list?


Luc Boissonneault 

Thanks Zahuur. I am trying to exclude any record that is a child of the current record from the parent selector. Because it's a chart of account, we need to block cases like:
A -> B -> C -> D -> A.
For example, the list of avalaible parents in C should not include A or B.

Answer

Matthew Dahlman

Luc Boissonneault, Zahuur's example would handle direct children. There's no way in SemQL to handle an arbitrary depth. But you could easily adapt this to preclude grandchildren, great grandchildren... etc up to any predetermined depth.
Login to post a comment