Page 1 of 1

Visibility based on several conditions

Posted: Fri May 10, 2019 5:26 pm
by lburkeckc
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

Re: Visibility based on several conditions

Posted: Fri May 10, 2019 6:14 pm
by BobRichards
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.