View Selection - Multiple forms

Hi,

There are 2 forms - form1 and form2. Form2 has field1 field which contains either yes or no. Now what I want for the view selection is that it should view documents from form1 but only if form2.field1=“Yes”.

I tried the below coding but it doesn’t display properly

SELECT (Form = “DB Add Licenses” | (Form = “State License Lookup” & LicRequired = “Yes”))

In view I see only unknown for each column.

Any suggestion or help would be greatful.

Subject: View Selection - Multiple forms

You can only select documents based on what they contain themselves – not on what other documents contain. There is an exception to this: if you are using the optional DB2NSF store, you can use a Query View. If you are using the NSF store, you will need to write the License Required data to the DB Add Licences documents.

Subject: RE: View Selection - Multiple forms

You seem to be thinking there is some sort of mystical connection between a document created with form1, and another document created with form2. Presumably there is some field that contains the same value in each, that associates them in your mind, but Notes cannot read your mind.

Stan says that the only criteria you can use to select documents to appear in a view, is the information that is in that document. That isn’t quite correct. You can also use @AllChildren and @AllDescendants to control whether a document appears in the view based on whether its parent document is also in the view. However, this is not useful for your purposes.

There are two routes you can take. One is to arrange to modify the data in your form1 document based on the data in the form2 document. You could do this with an agent that executes on schedule or whenever a form2 document is modified (you might also need code to execute when a form2 document is deleted or undeleted). Your agent would have to find the corresponding form1 document (based on a view search with the key value, perhaps) and change one of its fields. Then you could use that field in your selection formula.

Another possibility is to use a folder whose contents are determined automatically. This could be done by a server agent similar to the one described above, except that instead of modifying a form1 document, you would put it into a folder or remove it from the folder. Or, you could add event code to the folder to do something similar to the view indexer – when the folder is opened, update its contents with any recent changes before the user gets to see it.

Subject: RE: View Selection - Multiple forms

“Stan says that the only criteria you can use to select documents to appear in a view, is the information that is in that document. That isn’t quite correct.”

Hey Andre, if we are THAT picky today, I have to say, that the information if or if not a document is a response to some parent actually IS in the response doc … :slight_smile:

Subject: RE: View Selection - Multiple forms

Oh, I think I can out-picky you still. Here’s the data from a document:

$REF = FA1D16788DE2E33E852573E800795FBD

Form = “Approval”

Subject = “Is this document in the view?”

And here’s the view selection formula:

SELECT (Form = “Request” & Status = “Approved”) | @AllChildren

Is the document in the view? If you can’t tell, why not? You have the data from all its items.

Subject: RE: View Selection - Multiple forms

So you got me and Stan was all wrong: We cannot select documents at all, only the indexer can. :stuck_out_tongue:

We can only predict - in some cases - what might end up in the view index. So let me further refine my statement: You and me and Prem and Stan and the view indexer cannot select documents based on what they do not contain themselves.

Or put a little more seriously: Knowing the items of one (!) document is necessary, but not sufficient to tell if it should be included in the view index.