Visibility based on Lookup code

Questions about and code samples for adding visibility conditions within Select
Post Reply
bhardaway
Posts: 2
Joined: Tue Jul 31, 2018 2:24 pm

Visibility based on Lookup code

Post by bhardaway »

Hello

I was wondering, though I am sure it is possible, what the coding would be to based the visibility on the lookup table value of the Title company.
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Visibility based on Lookup code

Post by BobRichards »

Can you elaborate a bit?
Bob Richards, Senior Software Developer, SoftPro
bhardaway
Posts: 2
Joined: Tue Jul 31, 2018 2:24 pm

Re: Visibility based on Lookup code

Post by bhardaway »

Absolutely. So basically I would like the visibility of a folder to be view-able based on the lookup code in the Title contacts of the order contact screen.

So if the lookup code in the Title contact is "XYZ". Then they would be able to view folder "ABC".
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Visibility based on Lookup code

Post by BobRichards »

Perhaps similar to example #4 in the response to this post?
Visibilty Conditions Examples
You may need to modify it to loop through the contacts you are concerned with. Ultimately, return true if you find a match; false otherwise.
Bob Richards, Senior Software Developer, SoftPro
nicolelynch
Posts: 2
Joined: Mon Feb 08, 2021 5:20 pm

Re: Visibility based on Lookup code

Post by nicolelynch »

Thanks Bob. I was working on combining the lender code and the disclosure type. So writing one that says if the lender code is "abc" and the file is a CDF then show this folder. if no lender code or lender is not there then don't show or show as false. But I get a callpable error? so I know it is wrong, wrong, wrong still :)

# Only show this folder/document if there is a Lender with a code that has "abc" (code used for ___ bank).
# and if the file is a CD file type
# Code can be typed in any case combination

# If there is No Lender selected on the file or Lookup Code of selected Lender is blank, Hide Folder/file
for Lender in Order.Lenders(0):
if (Lender(0).LookupCode == None or not Lender.LookupCode):
# Not added to collection yet.
return False

elif Lender.LookupCode.lower() == 'abc' and hasattr(Order,'SettlementType') and str(Order.SettlementType)=='CDF':
return True
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Visibility based on Lookup code

Post by BobRichards »

The code below should handle your requirements. In this example, the lender lookup code is "abc" and the settlement type must be CDF to be visible. As you did in your code, we convert all lookup codes to lowercase before comparing them in order to make the lookup code comparison case insensitive.

Code: Select all

# Only show this folder/document if there is a Lender with the specified lookup code
#	and if the file is a CD file type.

# Enter Lender's code below. Can be typed in any case combination.
lenderLookupCode = 'abc'

# SettlementType values are defined below so logic can use any settlement type.
SettlementType_CDF = 0
SettlementType_HUD1 = 1
SettlementType_CSS = 2

# Don't display folder/document unless order is CDF.
if int(Order.SettlementType) != SettlementType_CDF:
	return False

# Force all lookup code comparisons to lowercase to so we don't have to
#	worry about mixed case later.
lenderLookupCode = lenderLookupCode.lower()

# We will check each lender, one at a time, to see if we can find the valid 
#   lookup code. If so, display folder/document.
for lender in Order.Lenders:
	if lender.LookupCode and lender.LookupCode.lower() == lenderLookupCode:
		# Found our lookup code - make items visible.
		return True

# We didn't find the lender. Don't display the folder/document.
return False
Bob Richards, Senior Software Developer, SoftPro
nicolelynch
Posts: 2
Joined: Mon Feb 08, 2021 5:20 pm

Re: Visibility based on Lookup code

Post by nicolelynch »

:lol: :D ;) :!: 8-) :) :D :lol: :!: Bob you rock my world!! Another condition solved, another user working that much more efficiently! Thank you so much!
Post Reply