Search screen - OR

  • Thread starter Thread starter bob biris
  • Start date Start date
B

bob biris

I'm building a search screen for an invoicing system.
The screen contains 10 fields corresponding to the data layout in the
DB (MyQuery(InvoiceID, Date, Name,Email)). We run the query,return a
dataset and bind it to a datagrid.
So far so good.

In addition, there is a requirement of having the possibility to put
and OR key in the field (for example Name: John OR Tom).

for example:
InvoiceID: 102 OR 103
Name: John OR Tom
Date: 02/02/2004
Email: (e-mail address removed) OR (e-mail address removed)

We were thinking about running the same query (8 times in this case).
MyQuery(102,'John','02/02/2004',[email protected])
MyQuery(102,'John','02/02/2004',[email protected])
MyQuery(102,'Tom','02/02/2004',[email protected])
MyQuery(102,'Tom','02/02/2004',[email protected])
MyQuery(103,'John','02/02/2004',[email protected])
MyQuery(103,'John','02/02/2004',[email protected])
MyQuery(103,'Tom','02/02/2004',[email protected])
MyQuery(103,'Tom','02/02/2004',[email protected])


Any idea what algorithm could be used to be those queries?
 
Bob,

This would be a bad thing, because what will end up happening is if you
place two entries into the field, and they are the same, then you will end
up getting duplicate results (assuming that filter returns something).

I think that you would be better of crafting a SQL statement to perform
the query once (MUCH more performant than making multiple hops).

Hope this helps.
 
Thanks, I was thinking of using datasets for each of the query on call
the merge method on it. I think the duplicates are ignored.

I was wondering on a more theoritical design what will be the best way
to get the data from this type of format:
InvoiceID: 102 OR 103
Name: John OR Tom
Date: 02/02/2004
Email: (e-mail address removed) OR (e-mail address removed)

into this type
(102,'John','02/02/2004',[email protected])
(102,'John','02/02/2004',[email protected])
(102,'Tom','02/02/2004',[email protected])
(102,'Tom','02/02/2004',[email protected])
(103,'John','02/02/2004',[email protected])
(103,'John','02/02/2004',[email protected])
(103,'Tom','02/02/2004',[email protected])
(103,'Tom','02/02/2004',[email protected])

where all the different possibilities can be listed?

Is anybody a cracker on mathematical algorithm?
 
Back
Top