Community
Vault Forum
Welcome to Autodesk’s Vault Forums. Share your knowledge, ask questions, and explore popular Vault topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Search using OR criteria on 2 fields

3 REPLIES 3
Reply
Message 1 of 4
greg.h
146 Views, 3 Replies

Search using OR criteria on 2 fields

Is it possible to search 2 fields for 1 value using an Or Criteria.
I have items that contain "To" and "From" fields. I am creating a custom app where I want to search on "Connections". If the user types "BOX A" in the Connection box, I want to search in for it in the To and the From field. I know it is possible to search 1 field for 2 values ( Criteria being From Contains val1 OR val2. But is it possible to search ona criteria "From Contains val1 OR to contains val1".
An example SQL query would be (searching for a value of P5)

SELECT * FROM table1 WHERE table1.From Like "*P5*"OR table1.To Like "*P5*"
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: greg.h

As you may already know, direct database access is unsupported.

Through the API you can only do AND type searches. However you can manually
create an OR search through the API by making two searches and performing a
union on the results.

Here are the steps:
1. Do the first search. Ex. To="Bob"
2. Do the second search. Ex. From="Bob"
3. Combine the results from the 2 searches.
4. Remove any duplicates.


Doug Redmond
Software Engineer, Autodesk Inc.
Message 3 of 4
ScottMe
in reply to: greg.h

Any possibility that this is going to change? This is a feature that is fairly common in other applications. For example, we recently changed or description procedure so it would be nice to search on "old description OR new description". I would think this is in pretty high demand.
Message 4 of 4
ScottMe
in reply to: greg.h

This got me most of the what I was looking for. It would be nice to have the option between different fields.

http://discussion.autodesk.com/adskcsp/thread.jspa?messageID=5212277

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums