Tech Tip: Searching for Multi-Value Fields, Part Two
By: Connie Anderson
Technical Writer
Multi-value fields enable you to store more than one value per field. For example, you might have two people who authored a document in your repository. You can add them both as authors of the document in the same “Author” field. Last week we discussed performing advanced searches for multi-value fields. This week we will go into more detail about the many options available for these search types. (For more information about advanced searches, see Performing Advanced Searches in the Laserfiche User Guide.)
In some cases, the order of your multi-value fields might matter. For instance, the primary author on a document might be listed first, with additional authors listed after. If you want to search for a document with a particular field value in a particular position, you would use the following syntax:
- {[]:[field](position)=“fieldvalue”}
For example, to search for entries with a multi-value “Author” field where the first author is “Jonathan,” the syntax would be:
- {[]:[Author](1)=“Jonathan”}
This would return all documents where Jonathan is the first author in the Author field, but not any documents where someone else is the first author, even if Jonathan is an additional author.
You can also perform searches for documents where at least one of a list of values is present in the field, even if they are not all present. You would use the following syntax:
- {[]:[field](any)=(“fieldvalue”,”fieldvalue”,“fieldvalue”)}
For example, to search for documents written by John, Bill, or Mary, the syntax would be:
- {[]:[Author](any)=(“John”,“Bill”,”Mary”)}
This search will return all entries assigned the multi-value “Author” field where “John,” “Bill,” or “Mary” is somewhere in the field. If even one name is present in the field, the document will be returned. It will also be returned if more than one of the names is present. However, if none of the three names is present, the document will not be returned.
If you want to ensure that all of the listed values are present, you would use the following syntax:
- {[]:[field](all)=(“fieldvalue”, “fieldvalue”, “fieldvalue”)}
For example, you might want to return all documents that Bill, John, and Mary worked on together, not just the documents that at least one of them worked on. You would use the following syntax:
- {[]:[Author](all)=(“John”,“Bill”,”Mary”)}
If you want to perform a search for documents that contain none of a particular list of values in the specified field, you would use the following syntax:
- {[]:[field](all) not in (“fieldvalue”,”fieldvalue”,“fieldvalue”)}
For example, perhaps you have already reviewed the documents worked on by John, Bill, and Mary using the above searches, and you want to find documents worked on by other people instead. You could use the following syntax:
- {[]:[Author](all) not in (“John”,“Bill”,”Mary”)}