Visibility based on several conditions
Posted: 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
# 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