Hi, How do I create a Hide When formula to determine if a document exists or not?
I have a valid selection formula used in a view. This results in a single document. ( or no documents at all ).
What is the best way to use this to test if a document is returned from the selection formula? Should I test the contents of a field or is there a better way at the document level?
Thanks
Alan
Subject: What are you trying to do?
I see hide when and view selection. What do you want to hide and when and how is the view selection linked into this?
What you do depends on what you need to do so a better problem definition would be helpful.
Subject: RE: What are you trying to do?
Sorry I wasn’t too clear
I have some shared Action buttons. I want to hide or show these in the action bar of a view.
One is to create a new document - so needs to be hidden if the document already exists.
The other is to edit a document - so needs to be hidden if it doesn’t already exist.
I have a view with a working selection that shows either nothing or a single document. So I thought I could convert that SELECT statement somehow and use it in the HideWhen.
So the question boils down to - how do you best test to see if a document, that matches certain selection criteria, exists? Best I can come up with is to test for the contents of a field on that document. If the contents are empty or it returns an error then the document doesn’t exist.
Cheers
Alan
Subject: RE: What are you trying to do?
You can simply use @DbColumn and check for “” if there’s only supposed to be zero or one document(s) in the view. You might not be able to do lookups in column or selection formulas, but there’s no problem using them in action hide-whens.
Subject: Yeah but…
It does work but the action does not refresh unless you exit/reopen the view. This would allow someone to add multiple docs of unless your doc save code exits the view and reopens to remove the action.
You may want to do some checking within the action code to abort if does, in fact, exist but the action still shows.