locked
Difference between ModelItem.Parent and ModelItem.Parents? RRS feed

Answers

  • As far as I can remember ModelItem.Parent just returns any parent, not necessarily the logical parent in a particular sense.
    E.g. it doesn't necessarily give you the parent activity in the logical tree of activities in the workflow (of which there is always only one).
    If you're dealing with a scenario where there are likely multiple parents it may be best to walk the collection looking for a specific object you are interested in.
    Tim

    • Marked as answer by Notre Wednesday, May 23, 2012 4:46 PM
    Wednesday, May 23, 2012 5:31 AM

All replies

  • Hi Notre,

    Imagine a graph of ModelItems. For a specific node in the graph, ModelItem.Parents returns all the parent nodes while ModelItem.Parent only returns one of the parent nodes.

    Could you please elaborate further on what you're trying to achieve by using ModelItem.Parent and/or ModelItem.Parents ? Without knowing more details, it would be hard to point you to the right direction.

    Thank you,

    Hani

    Monday, May 21, 2012 10:12 PM
  • Hi Hani,

    My question originally came out of a desire to walk up the model item tree, to discover information about a model item's in scope variables. 

    Which node would ModelItem.Parent return?  It sounds like there is not necessarily a single definitive parent, so I'm unclear on what it would return.

    Thanks,

    Notre

    Wednesday, May 23, 2012 12:43 AM
  • As far as I can remember ModelItem.Parent just returns any parent, not necessarily the logical parent in a particular sense.
    E.g. it doesn't necessarily give you the parent activity in the logical tree of activities in the workflow (of which there is always only one).
    If you're dealing with a scenario where there are likely multiple parents it may be best to walk the collection looking for a specific object you are interested in.
    Tim

    • Marked as answer by Notre Wednesday, May 23, 2012 4:46 PM
    Wednesday, May 23, 2012 5:31 AM
  • Hi Tim,

    Wow, that's disappointing re: the behaviour of ModelItem.Parent.  Thanks for letting me know!

    Notre

    Wednesday, May 23, 2012 4:46 PM