Hi all, I've gone through all of the prior postings in regards to the visibility conditions and I was able to make several of the codes work for our company, so a big THANK YOU for all that asked those questions! Python is not my first language (or second, not even in the top 10), but I've been able to piece together codes from what others have posted. Forgive me if I'm using incorrect terms.
TL:DR Is it possible to set a visibility condition based on if a field is blank?
We have two doc sets -- We'll call them "Commitment Docs (REG)" and "Commitment Docs (STD)".
At first I was looking for the set "Commitment Docs (STD)" to be visible only if a field in SoftPro equals "STD". We picked a random field that we were not using and was able to get it to work with the following code:
return str(Order.Settings.PublishOnlineData) == 'STD'
However, I'd also like the other set to be hidden/invisible if that SoftPro field = "STD". The way I was trying to make this work is to set a visibility condition on BOTH document sets where one is...
return str(Order.Settings.PublishOnlineData) == 'STD'
and the other is...
return str(Order.Settings.PublishOnlineData) == 'null or blank'
Any ideas?
Visibility based on blank field
-
- Posts: 1382
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Visibility based on blank field
You have come up with a good idea to handle the documents for your users. Below are a few basic building blocks for parsing user input safely.
Example 1: Return True if user enters 'STD' in Related Orders
Is it possible to set a visibility condition based on if a field is blank?
Example 2: Enable document if user did NOT enter text in a field.
Example 3: Enable document if user did NOT enter text in a field or entered 'STD'. In other words, set up the field so the default behavior is to treat the field as 'STD' unless the user enters a different code.
Code: Select all
s = None
t = str(s) # t = 'None'
t = bool(s) # t == False
s = "" # string of length zero
t = bool(s) # t == False
s = "Hello" # string containing one or more characters
t = bool(s) # t == True
Code: Select all
return str(Order.Settings.PublishOnlineData) == 'STD'
Example 2: Enable document if user did NOT enter text in a field.
Code: Select all
return not bool(Order.Settings.PublishOnlineData)
Code: Select all
return not bool(Order.Settings.PublishOnlineData) or str(Order.Settings.PublishOnlineData) == 'STD'
Bob Richards, Senior Software Developer, SoftPro
-
- Posts: 3
- Joined: Sat Apr 27, 2019 3:14 pm
Re: Visibility based on blank field
Thank you so much!!! I will try this out!!