Multiple (unrelated) declarative parameters

T

Tastic

Hi, I am working on a search & filter form using about 6 different
dropdown boxes, and possibly more to come.

Here is what I am trying to acheive; if the user does not specfiy any
choice in a ddb then then that particular filter is not applied... I
am probably not making a lot of sense here...

dd1 = Business Type (accountant/lawyer/restaurant etc)
dd2 = Business Category (Service / Price / Product Quality etc) ie
what is more important to the user
dd3 = product type(for accountant this would be type of accountant,
for a restaurant it would be type of cuisine)
dd4 = suburb
dd5 = City
dd 6 = Country

in order to select suburb the user will need to first select City,and
in turn first select country
this part is fine, I know how to set this up

but if the usr only selects values from say dd1 and dd3 and dd6 then
the other parameters should be removed but leave the ability for the
usr to then turn around and filter more

I have done this with one ddb through objectdatasource the DAL has two
select queries one with the parameter and one with out. The BLL simply
states if parameter >0 call (select without)
else call (select with)
My actual question: am I going to have to sit here and manually go
through every possible combination of parameters used? (this would be
exceptionally time consuming not to mention messy)

or is there something I can do in my BLL to add or remove parameters
depending on selections
 
J

John Saunders

Tastic said:
Hi, I am working on a search & filter form using about 6 different
dropdown boxes, and possibly more to come.

Here is what I am trying to acheive; if the user does not specfiy any
choice in a ddb then then that particular filter is not applied ....
My actual question: am I going to have to sit here and manually go
through every possible combination of parameters used? (this would be
exceptionally time consuming not to mention messy)

or is there something I can do in my BLL to add or remove parameters
depending on selections

What if your query was something like this:

SELECT * FROM MY_TABLE
WHERE (
((@DDL1_PRESENT AND DDL1 = @DDL1) OR (NOT @DDL1_PRESENT)) AND
((@DDL2_PRESENT AND DDL2 = @DDL2) OR (NOT @DDL2_PRESENT)) AND ...
)

Then your only trick would be to supply the *_PRESENT parameters by testing
to see if ddl's have the "Please Select" item selected.

John
 
T

Tastic

What if your query was something like this:

SELECT * FROM MY_TABLE
WHERE (
((@DDL1_PRESENT AND DDL1 = @DDL1) OR (NOT @DDL1_PRESENT)) AND
((@DDL2_PRESENT AND DDL2 = @DDL2) OR (NOT @DDL2_PRESENT)) AND ...
)

Then your only trick would be to supply the *_PRESENT parameters by testing
to see if ddl's have the "Please Select" item selected.

John

Thanks very much I'll see how it goes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top