Link to home
Start Free TrialLog in
Avatar of Martin Cotterill
Martin CotterillFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Display filtered group

Hi there

I have created a site in Dreamweaver that connects to an MS Access database through a DNSless connection.

One of the fields in the database is called 'Price'. As you might expect, the data for 'Price' varies.

What I want to do is, from a link that says, for example, $0 - $100,000 display only those records that are between $0 and $100,000. If there was a link that said $100,000 - $150,000, then only those records that fell into that criteria would be displayed.

Is there any way to do this in Dreamweaver?

Many thanks in advance

Martin
Avatar of dodge20
dodge20

Yes this can be done in dreamweaver.

I would suggest instead of doing links, to either put a dropdown menu with the ranges or 2 text boxes where the user can enter a range.

For the 2 text boxes method (easiest)
On your first page create 2 text boxes and call them txtLowPrice and txtHighPrice
Submit your form to your results page
On your results page create a query:
select * from your table
where price between varLowPrice and varHighPrice

Your variables would be
varLowPrice      1     Request("txtLowPrice")    
varHighPrice      1     Request("txtHighPrice")


Avatar of Martin Cotterill

ASKER

Hi D

Thanks for the reply.

I'll give it a go and get back to you soonest.

Martin
Hello again D20

I do need the variables to be in a link. The text box method won't do for this project.

However, I have set up the SQL statement in my page 'resales.asp' as you have suggested.

I then have tried to run link from a page called 'test.asp' that sends the required data to 'resales.asp' but I can't figure out how to do it. I have tried various ways around the '...resales.asp?....' idea but to no avail.

What am I doing wrong?

Regards

Martin
Are you submitting a form?

If not, then I would suggest creating a seperate page for each link you want. Then on the linked page you can just have a recordset with the appropriate price range. For example:

select * from yourtable
where Price Between '0' and '100000'

then for your second link I would create a second page with a recordset
select * from yourtable
where Price Between '100000' and '150000'
Hi D20

Im not submitting a form. I have a page inside an <iframe> that displays the results. At the moment I can do things like filtering based on, say, number of bedrooms (resales.asp?2) and it works fine. I just wondred how to do this with the price but in groups.

Martin
ASKER CERTIFIED SOLUTION
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Rouchie

Thanks for the reply.

I'm doing this in ASP using Dreamweaver 8. I've nearly finished a course in Dreamweaver and for my final assessment I'm doing a small data driven site, so I'm new to all this. Before DW I coded everything by hand.

I can create small, easy databases in Access (my next project is to learn MySQL - thought I'd better had) so I know nothing of SQL queries, etc.

The links are just as I had in mind but I can't make the SQL work. What do I need to do?

Many thanks

Martin
Within dreamweaver there is an option to create a recordset, which uses a SELECT statement.  Within the wizard for creating this, you can tell it to look for the search parameters in the queryString.

I currently don't have DW on my machine so I can't remember exactly how to get into it, but that's what you need to do.  Alternatively (as I do) you could write it all out manually by hand.  The problem however is that if the idea is to get DW to do everything 'for you', then that's not going to happen this way!

These 2 pages shed some light on what to do:

  http://www.adobe.com/devnet/dreamweaver/articles/easy_sql.html
  http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16386

...although where the dialogue box field says FILTER, you need to select the querystring rather than a form value.
Thanks for the links. I'll check them out and get back to you.

Martin
Hi Rouchie

Just got it to work.

Within DW select the 'Recordset' under the 'Bindings' tab in the 'Applications' panel. Click on the 'Advanced' button and in the 'SQL:' section enter:
   
     SELECT *
     FROM tblResale
     WHERE Price BETWEEN lowerVal AND upperVal
     ORDER BY Price ASC

Then click the 'plus' button in the 'Parameter:' section and then define the variables. In this case 'lowerVal' and 'upperVal'.

Enter the 'Name:' of the variable and it's 'Type:' (lowerVal and numeric) and in 'Value:' enter 'Request.Querystring("lowerVal")'. Enter a 'Default value:' (I entered 1) and the do the same thing for the variable 'upperVal' remembering to replace the relevant 'Name:' and 'Value:' sections.

Then use the links as you suggest and away it goes.

FAB!!!!!!! :) :) :)

Many thanks for your time

Kind regards

Martin
No problem.  Good luck with the rest of the project!