navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Can this even be done with VBScript?

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Can this even be done with VBScript?
Page: [1]
 
mesturee

 

Posts: 40
Joined: 9/1/2005
Status: offline

 
Can this even be done with VBScript? - 9/15/2005 12:16:21   
Mornin'

I have an idea, based on what I have read about VBScript, but I am not sure if it is even possible.

Here's the info:
I have a query consisting of six search fields.

They are:
Load (two textboxes to search a range)
SettingDepth (two textboxes to search a range)
WaterDepth (two textboxes to search a range)
Casing (populated by database)
Customer (populated by database)
Slip (populated by database)

Each Selection has two Radio buttons next to it. (AND) and (OR) with and being the default.

Spooky suggested a way of building my query to incorporate these radios.

Here is his suggestion
SELECT * FROM [LSjob]
WHERE (Load BETWEEN ::Loadfrom:: AND ::Loadto::)
::radio1:: (SettingDepth BETWEEN ::Settingfrom:: AND ::Settingto::)
::radio2::(WaterDepth BETWEEN ::Waterfrom:: AND ::Waterto::)
::radio3:: (Casing LIKE '%::Casingddb::%')
::radio4:: (Customer LIKE '%::Customerddb::%')
::radio5::  (Slip LIKE '%::Slipddb::%') ORDER BY JobNumber


It did work, but not in the way I needed.

With the setup that I have, every field entry narrows down the results of the previous fields. So when an OR is place in the middle of the chain, every field that comes after the OR narrows down the returned results of the OR statement.

I need the OR(s) to be return all records that match the field, regardless of what how the other fields are narrowed down.

That basically means that the Or statements need to be at the back of the string. However, since the choice of and/or is up the user, that could lead to a number of different possibilities.

Here is a quick write up of the way I see this thing playing out. (please keep in mind that I know very little about the correct Syntax, so this will be incorrect)
<%
dim myquerystring
dim varone
dim vartwo
dim varthree
dim varfour
dim varfive
dim varsix
dim radbutone
dim radbuttwo
dim radbutthree
dim radbutfour
dim radbutfive
dim radbutsix
dim andradone
dim andradtwo
dim andradthree
dim andradfour
dim andradfive
dim andradsix
dim andvarone
dim andvartwo
dim andvarthree
dim andvarfour
dim andvarfive
dim andvarsix
dim orradone
dim orradtwo
dim orradthree
dim orradfour
dim orradfive
dim orradsix
dim orvarone
dim orvartwo
dim orvarthree
dim orvarfour
dim orvarfive
dim orvarsix
varone = ("(Load BETWEEN ::Loadfrom:: and ::Loadto::)")
vartwo = ("(Settingdepth BETWEEN ::Settingfrom:: and ::Settingto::)")
varthree = ("(Waterdepth BETWEEN ::Waterfrom:: and ::Waterto::)")
varfour = ("(Casing LIKE '::Casingddb::%')")
varfive = ("(Customer LIKE '::Customerddb::%')")
varsix = ("(Slip LIKE '%::Slipddb::%')")
andradone = (' ')
andradtwo = (' ')
andradthree = (' ')
andradfour = (' ')
andradfive = (' ')
andradsix = (' ')
andvarone = (' ')
andvartwo = (' ')
andvarthree = (' ')
andvarfour = (' ')
andvarfive = (' ')
andvarsix = (' ')
orradone = (' ')
orradtwo = (' ')
orradthree = (' ')
orradfour = (' ')
orradfive = (' ')
orradsix = (' ')
orvarone = (' ')
orvartwo = (' ')
orvarthree = (' ')
orvarfour = (' ')
orvarfive = (' ')
orvarsix = (' ')
myquerystring = myquerystring & "SELECT * FROM [LStable] 
WHERE (Load BETWEEN 0 AND 100000000) 
andradone andvarone 
andradtwo andvartwo 
andradthree andvarthree 
andradfour andvarfour 
andradfive andvarfive 
andradsix andvarsix 
orradone orvarone 
orradtwo orvartwo 
orradthree orvarthree 
orradfour orvarfour 
orradfive orvarfive 
orradsix orvarsix ORDER BY JobNumber"
IF ::radio1:: = (OR) THEN REPLACE orradone WITH ("OR")
ELSE
IF ::radio1:: = (AND) THEN REPLACE andradone WITH ("AND")
END IF
IF ::radio1:: = (OR) THEN REPLACE orvarone WITH varone
ELSE
IF ::radio1:: = (AND) THEN REPLACE andvarone WITH varone
END IF
IF ::radio2:: = (OR) THEN REPLACE orradtwo WITH ("OR")
ELSE
IF ::radio2:: = (AND) THEN REPLACE andradtwo WITH ("AND")
END IF
IF ::radio2:: = (OR) THEN REPLACE orvartwo WITH vartwo
ELSE
IF ::radio2:: = (AND) THEN REPLACE andvartwo WITH vartwo
END IF
IF ::radio3:: = (OR) THEN REPLACE orradthree WITH ("OR")
ELSE
IF ::radio3:: = (AND) THEN REPLACE andradthree WITH ("AND")
END IF
IF ::radio3:: = (OR) THEN REPLACE orvarthree WITH varthree
ELSE
IF ::radio3:: = (AND) THEN REPLACE andvarthree WITH varthree
END IF
etc...
%>


:) Like I said, I know it is not right, and is probably missing a lot. It should illustrate what I need though.

If anyone could look it over and tell me if it is even a possibility, it would help me out.....a lot.

Thanks

Eric
mesturee@sbcglobal.net

Page:   [1]

All Forums >> Web Development >> ASP and Database >> Can this even be done with VBScript?
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts