Iterating through all phrases of an exception

Discussions related to custom development with Select.
Post Reply
Nrhoades
Posts: 5
Joined: Tue Oct 20, 2020 2:09 pm

Iterating through all phrases of an exception

Post by Nrhoades »

Hi,

I'm trying to figure out how to get the very last phrase in a commitment exception with nested phrases.

For example:

I have a list of exceptions and Ill get the last exception in the list of exceptions as such,

IOrderItem previousException = (IOrderItem)newExceptions[newExceptions.Count-1];

Lets say this returns an exception that has a child phrase, and that child phrase is another exception, and then that child has a phrase that is an exception. How would I get the very last child phrase in this exception with nested child phrases (exceptions)?
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Iterating through all phrases of an exception

Post by BobRichards »

We do not have any special search capability in this area. You will have to do it brute-force with some ugly logic. Sorry.
Bob Richards, Senior Software Developer, SoftPro
Nrhoades
Posts: 5
Joined: Tue Oct 20, 2020 2:09 pm

Re: Iterating through all phrases of an exception

Post by Nrhoades »

Not a problem. More specifically I was looking for the logic to pull a child phrase from its parent.
I've tried this:

var phrases = exception.GetProperty["Phrases"];

var childException = phrases[0];

with no such luck. Would you be able to provide an example? Thanks.
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Iterating through all phrases of an exception

Post by BobRichards »

Did you get an error? If so, what was it.

Did you cast the "exception.GetProperty["Phrases"];" to an IList so it can be indexed in the next line?
Bob Richards, Senior Software Developer, SoftPro
Post Reply