Visibility based on several conditions

Questions about and code samples for adding visibility conditions within Select
Post Reply
lburkeckc
Posts: 6
Joined: Tue Apr 16, 2019 3:41 pm

Visibility based on several conditions

Post by lburkeckc » Fri May 10, 2019 5:26 pm

I need to have this snippet to do the below statements. What I can't figure out is the first two lines of code. I don't want the document to show if the property state is WI, but then the coding after that needs to be to show if a Refinance and if not a Refinance then at least two of the following conditions must be met.

# If this is Refinance, Show this doc
# If the State is WI, Don't Show
# Show if Sales Price is Greater than $500,000
# OR the 1st Property Use is NOT Residential
# OR the Underwriter is NOT North American
#(any one of the exceptions, even if the other two are met, will cause doc to show)
#(Ex. If Sales price is Greater than $500,000 but UW is NATIC, this doc will show)

# If Order State = WI, Don't Show
if Order.Properties[0].Address.State.Code == 'WI'
return False

else:

# If Refi, Show
if Order.TransactionType == Order.TransactionType.Refinance:
return True

else:
# Check is Sales Price is $500,000 or Less
SPUnder500K = False
if Order.SalesContract.SalesPrice <= 500000:
SPUnder500K = True

# Check if Property Use is Residential
PropUseIsResidential = False
if Order.Properties[0].Use.Description == 'Residential':
PropUseIsResidential = True

# Check if the 1st Underwriter contact has a code that has the first 2 characters - "NA" typed in any case combination
# If the 1st Underwriter's Lookup Code is blank, it's not NATIC
UWIsNATIC = False
if not Order.Underwriters[0].LookupCode:
# Undewriter is Still blank
UWIsNATIC = False

elif Order.Underwriters[0].LookupCode.lower()[:2] == 'na':
UWIsNATIC = True

# If all are true (Sales Price is Under $500,000, Property Use is Residential, AND Underwriter is NATIC) then HIDE Doc
if SPUnder500K and PropUseIsResidential and UWIsNATIC:
return False
else:
return True

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

Re: Visibility based on several conditions

Post by BobRichards » Fri May 10, 2019 6:14 pm

You have some very good questions pertaining to basic logic flow in a program. However, this is out of scope for this forum. It is our mission to provide information more specific to Select and not programming in general. Several of our customers have googled "Python programming" and found online courses and books to help them understand how to break problems down then put the Python/Select pieces together. I would recommend you pick up a book on learning Python so the process is less frustrating.

If you need a quicker turn-around time, please contact the Custom Development Group by calling the SoftPro main number at 800-848-0143 or Custom Development - SoftPro.

If you want to post your code in the future for me to look over, please maintain the proper formatting of your code by clicking the Code display button </> (in the row of icons above the text entry box) then enter your code between the <code></code> tags. Otherwise, all leading white space is removed and I cannot review it.
Bob Richards, Software Developer, SoftPro

Post Reply