Select Database Questions

Discussions related to SoftPro Select user interface development.

Moderator: Phil Barton

bandorganman
Posts: 23
Joined: Tue Mar 03, 2020 5:23 pm

Re: Select Database Questions

Post by bandorganman » Mon Jul 20, 2020 5:49 pm

Hi, In creating an order, how do I enter multiple contacts of the same type? For example:

o.Contacts.ContactType = "Attorney";
o.Contacts.Name = ms.ATTYNAME;

Now I want to enter a second attorney without overwriting the first. How do I do this? Same for buyers, sellers, banks etc.

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

Re: Select Database Questions

Post by BobRichards » Mon Jul 20, 2020 9:13 pm

If the contact is already part of the order, you can get it from from the order and modify it's properties. In this case I'm modifying the first existing Settlement Agent.

Code: Select all

// Modify existing Settlement Agent (must exist!)
IList agents = (IList)order.GetProperty("SettlementAgents");
IOrderItem agent = (IOrderItem)agents[0];
agent.SetProperty("Name", "The Settlement Agency");
// Modify any other properties.
You can create a new contact by getting an empty one from the order and set it's properties - we'll create another Settlement Agent. It is very important that you add new items to the appropriate collection ("Contacts" in these examples) before setting any properties. Default internal order rules may not run if this is not done.

Code: Select all

// Create a new Settlement Agent and provide all properties.
IList contacts = (IList)order.GetProperty("Contacts");
IOrderItem newSA = order.CreateNew("SettlementAgent");
// Always add new contact to Contacts before writing to properties (not to SettlementAgents, etc)!
contacts.Add(newSA);
// Now set properties.
newSA.SetProperty("Name", "The Settlement Agency 2");
Another way to create a new contact is to create the base type then use a lookup table to populate the previously saved information. This is excellent for often used and company contacts. All you have to is set the LookupCode property.

Code: Select all

// Create a new Settlement Agent and populate is with Lookup Table information.
IOrderItem lookupSA = order.CreateNew("SettlementAgent");
// Always add new contact to Contacts before writing to properties (not to SettlementAgents, etc)!
contacts.Add(lookupSA);
// Now set properties.
lookupSA.SetProperty("LookupCode", "ATA-70-02");
Finally, you can get a list of all contact types that can be created by searching on "ContactType" in the SoftPro Select SDK Documentation installed in your system. You can create all types EXCEPT "AllBuyers" and "AllSellers".
Bob Richards, Software Developer, SoftPro

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

Re: Select Database Questions

Post by BobRichards » Mon Jul 20, 2020 9:23 pm

Also, please create a new topic when you are addressing different questions. It makes it easier to search on in the "Search..." box when others look for help.

Thanks! :D
Bob Richards, Software Developer, SoftPro

bandorganman
Posts: 23
Joined: Tue Mar 03, 2020 5:23 pm

Re: Select Database Questions

Post by bandorganman » Tue Jul 21, 2020 9:30 am

Thanks, Bob! I will start a new post in the future.

Post Reply