Page 1 of 1

Visibility based on Lookup code

Posted: Tue Aug 14, 2018 7:22 pm
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.

Re: Visibility based on Lookup code

Posted: Wed Aug 15, 2018 3:42 pm
by BobRichards
Can you elaborate a bit?

Re: Visibility based on Lookup code

Posted: Fri Aug 17, 2018 7:38 pm
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".

Re: Visibility based on Lookup code

Posted: Mon Aug 20, 2018 10:17 am
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.

Re: Visibility based on Lookup code

Posted: Mon Feb 08, 2021 6:25 pm
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

Re: Visibility based on Lookup code

Posted: Tue Feb 09, 2021 12:34 pm
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

Re: Visibility based on Lookup code

Posted: Tue Feb 09, 2021 8:19 pm
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!