Folder visibility when uw is not NA

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

Folder visibility when uw is not NA

Post by lburkeckc » Tue May 14, 2019 11:31 am

Visibility isn't working. I need this condition to show a folder only when NA is not the underwriter. If there are no Underwriters or if Underwriter is one other than NA, then the folder should not show. If the Underwriter is NA, then it should not show the folder.

Code: Select all

if Order.Underwriters.Count == 0:
	# No underwriters: hide folder
	return False

if Order.Underwriters[0].LookupCode is None:
	# First underwriter has no LookupCode: hide folder
	return False
	
if Order.Underwriters[0].LookupCode <> "CT"
	#Hide folder if LookupCode is "CT": hide folder
	return False

# Hide folder if LookupCode is "NA"
return Order.Underwriters[0].LookupCode != "NA"

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

Re: Folder visibility when uw is not NA

Post by BobRichards » Tue May 14, 2019 12:51 pm

The problem is the CT test (that is missing from the description but the program comments are clear as to the desired function). You should use equals "==" so if the lookup code is "CT" it will return false. Your code for that test will return false for any lookup code other than "CT". I have changed the code to reflect the correct logic.

Code: Select all

if Order.Underwriters[0].LookupCode == "CT"
	#Hide folder if LookupCode is "CT": hide folder
	return False
Bob Richards, Senior Software Developer, SoftPro

Post Reply