Page 1 of 1

Visibilty Conditions Examples

Posted: Tue Jul 11, 2017 2:40 pm
by slind
I sent this in to support, but they are probably just going to direct me here.

May I please get examples on the syntax for the following:

1. If Property State = “KY”
2. If Property State in [“IN”, “KY”, “OH”]
3. If Property State = “KY” or “Null” (or blank)
4. If Lender Lookup Code = “ABC”
5. If Custom Underwriter Field {{602-512UndCode##}}=”FA-KY”
6. If Transaction Type = “Purchase”

Thanks!
Stephanie

Re: Visibilty Conditions Examples

Posted: Tue Jul 11, 2017 5:37 pm
by BobRichards
1. If Property State = “KY”

Code: Select all

# Get state for first property.
state = Order.Properties[0].Address.State

# Return True if there is a state object and it matches.
return state and state.Code == 'KY'
2. If Property State in [“IN”, “KY”, “OH”]

Code: Select all

# Get state for first property.
state = Order.Properties[0].Address.State

# Return True if there is a state object and it matches.
return state and state.Code in {'IN', 'KY', 'OH'}
3. If Property State = “KY” or “Null” (or blank)

Code: Select all

# Get state for first property.
state = Order.Properties[0].Address.State

return (state is None
		or state.Code == 'KY'
		or not state.Code)
4. If Lender Lookup Code = “ABC”

Code: Select all

# Get first lender.
lender = Order.Lenders[0]

# Return True if there is a lender and the lookup code matches.
return lender and lender.LookupCode == 'ABC'
5. If Custom Underwriter Field {{602-512UndCode##}}=”FA-KY”

Not currently possible since it would require the IOrderItem interface that is not available here and you can't import.

6. If Transaction Type = “Purchase”

Code: Select all

# I hate converting enums to strings for comparison, but the library for resolution
#    is not available here and you can't import.
return str(Order.TransactionType) == 'Purchase'

Re: Visibilty Conditions Examples

Posted: Wed Jul 12, 2017 10:47 am
by slind
Thank you so much! This helps so much. My users are going to be so happy as we do business in three states with four different Underwriters so our trees are kind of crazy.

We have the custom Underwriter field because we were told that we should not change the Underwriter lookup codes because you guys do something in the background with it. So First American needed to stay "FA" etc. Since we do business in three states we needed to break our underwriters down further so we made a custom field that is "FA-KY", "FA-OH", "FA-IN" etc. for all our underwriters. I would like to trim down the Document tree and only show the Underwriter/State that fits the file.

I guess I could do an "AND" statement to check the underwriter and the state in a file. (Can you please help me with the syntax for an "AND" statement? I tried the following on one of the First American folders and the folder still displays even if it isn't First American. What do I have wrong?

return any(u.Name == 'First American Title Insurance Company' for u in Order.Underwriters)

Re: Visibilty Conditions Examples

Posted: Wed Jul 12, 2017 12:19 pm
by slind
I actually tried
# Get state for first property.
state = Order.Properties[0].Address.State

# Return True if there is a state object and it matches.
return state and state.Code == 'KY'

On the Underwriter folder for First American KY and it still displayed on other states. That logic is working great on all my Kentucky documents in my User Document Tree. Is there something special about the Underwriter folders that prohibits the Visibility Conditions from running? I couldn't find any specific rights tied to them.

I also noticed that you guys have started to add Visibility Conditions to a few of your documents (CDF/HUD etc.), it would be great if you would just by default include the visibility condition of Underwriter/State on the Underwriter Bundles. Thank you for all your help, I really appreciate it!

Re: Visibilty Conditions Examples

Posted: Thu Jul 13, 2017 8:35 pm
by BobRichards
There is nothing special about any folder. Select client will have the old visibility rule in memory, though, so you may want to try closing the Documents window.

Re: Visibilty Conditions Examples

Posted: Wed Dec 20, 2023 2:56 pm
by RBeer
Can this be done based off the properties city?
I've been trying to do it and I keep getting errors.
For example, I want a document to only show for the 5 NY Boroughs.
Thanks!

Re: Visibilty Conditions Examples

Posted: Sat Dec 23, 2023 5:18 pm
by BobRichards
So me your code to take a look at.