Setting ListIndentLevel

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

Setting ListIndentLevel

Post by Nrhoades »

Hi,

I'm currently trying to set the field "ListIndentLevel"
I've tried doing this a couple different ways, such as:

exception.SetProperty("ListIndentLevel", commitmentException.IndentLevel);

and

exception["ListIndentLevel"] = commitmentException.IndentLevel;

When doing this I keep getting hit with a "Cannot access member" exception. How do I set this?

Thanks!
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Setting ListIndentLevel

Post by BobRichards »

ListIndentLevel is a readonly property to indicate the current level of indentation.

It appears the typical way to change the level of indentation is by passing a new phrase into IncreaseIndent() or DecreaseIndent(). Also adding a child phrase to an existing phrase will increase the level of indent.
Bob Richards, Senior Software Developer, SoftPro
Nrhoades
Posts: 5
Joined: Tue Oct 20, 2020 2:09 pm

Re: Setting ListIndentLevel

Post by Nrhoades »

Thank you for the swift response Bob. Would you be able to show a quick example of passing a new phrase into IncreaseIndent() or DecreaseIndent()?
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Setting ListIndentLevel

Post by BobRichards »

I'm glad you spoke up for an example. I was leading you down a long hole. The best way to create lists of Exceptions, Requirements, and Subordinate Matters is demonstrated below.
  • In this example, I navigate down to a previously created loan policy and get the Exceptions list.
  • Next I create an Exception object, initialize its properties then add it to the list of exceptions.
  • Then I create a second exception and set the Code property to one that exists in a lookup code. All we have to do is set the Code and the remainder is set from lookup table information.
  • The final exception is where I create a child. All that means is it will be indented a single level under its parent. I add the new exception to the Phrases collection of the existing exception that is to be the parent.
  • The final step is to save the order changes.

Code: Select all

// IOrderItem title = (IOrderItem)order.GetProperty("Title");
IOrderItem tic = (IOrderItem)((IList)title.GetProperty("TitleInsuranceCalculations"))[0];
IOrderItem lp = (IOrderItem)tic.GetProperty("LoanPolicy");
IList exceptions = (IList)lp.GetProperty("Exceptions");

// Set both Code, Text and Comment properties.
IOrderItem ex = order.CreateNew("Exception");
ex["Code"] = "PE1";
ex["Text"] = "Policy exception 1";
ex["Comment"] = "Policy exception 1 comment";
exceptions.Add(ex);

// Only need to set Code since it is in lookup table and Text will be filled in automatically.
ex = order.CreateNew("Exception");
ex["Code"] = "A100";
exceptions.Add(ex);

// Make next one child (indented) by adding it to parent Phrases collection.
IOrderItem child = order.CreateNew("Exception");
child["Code"] = "A105";
((IList)ex["Phrases"]).Add(child);

IOrderStore os = (IOrderStore)order.GetService(typeof(IOrderStore));
os.ApplyChanges(order);
2020-11-12_14-48-12.png
2020-11-12_14-48-12.png (34.46 KiB) Viewed 848 times
The hardest part to remember is that all of these types of objects (Exception, Requirement, EndorsementException, EndorsementRequirement, and Subordinate Matters) have a Phrases collection. Add the the Phases to create children (a.k.a. indent to the right).
Bob Richards, Senior Software Developer, SoftPro
Nrhoades
Posts: 5
Joined: Tue Oct 20, 2020 2:09 pm

Re: Setting ListIndentLevel

Post by Nrhoades »

That makes a lot of sense. I think Ill be able to utilize this to implement my solution. Thanks for the fast and detailed responses!
Post Reply