Variables in FP2003

N

ND Viste

In a 2/17/04 correspondence from MJ Smith regarding “FP2003 Database Result from custom query setupâ€, Jon replied that
“FP won't accept a variable in the DRW - only form and querystrin
parameters. There's a couple of ways to get FP to accept parameters, none o
them very prettyâ€

What are the “Couple of ways� Microsoft Knowledge Base Article – 306430 only addresses using Search Form Fields, not general variables

Also, many folk appear to be having trouble with variables in FP2003 – is there a problem that needs fixing? Should I go buy FP2002

Thanks for the help

ND Vist
 
M

MD Websunlimited

Hi,

Define variable?

dim var1 as string
var1 = "DRW" ' this is a variable

it would be used in a custom query like so

"SELECT * FROM table WHERE fieldx = ' & var1 & "';"

A statement with a form field "parameter" and a variable
"SELECT * FROM table WHERE fieldx = ' & var1 & "' AND type ='::fldType::';"

where fldType is an input field from a form or query string

Query String = http://www.myweb.com/mypage.htm?fldType=big
Input field = <input type="text" name="fldType" >
--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
J-Bots Plus 2002 87 components for FrontPage
http://www.websunlimited.com/order/Product/JBP2002/jbp_help_dir.htm
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible
 
N

ND VBiste

I tried the custom query you suggested, with a slight change to the quotes punctuation to avoid getting syntax errors back

My code is: (using some JavaScript and FrontPage 2003

owner=parent.Nameholder.localownernam
document.writeln("<p><b><u>"+owner+"'s Wish List</u></b></p>"

fp_sQry="SELECT * FROM wishlists WHERE person =' & owner & '
o
fp_sQry="SELECT * FROM wishlists WHERE person = ""' & owner & '""

These both produced the following output
norm's Wish Lis
ID person category description source cost comment
No records returned

When I change to a literal

fp_sQry="SELECT * FROM wishlists WHERE person = ""norm""

Then I get what I want: (so the data base is OK

ID person category description source cost comment
1 norm L'Amour Books 0
2 norm DeMille Books 0
3 norm Train Stuff 0

Any other suggestions?
 
M

MD Websunlimited

You're mixing client side script (JavaScript) with server side script (VB Script) it doesn't work that way.

The value of owner can be passed to the server via either a querystring http://www.mysite.com/mypage.htm?owner=Norm or via a hidden
form field. The following JScript populates the hidden field owner in the form.

document.forms[0].owner.value = parent.Nameholder.localownername;

On the server the SQL would look like fp_sQry = "select * from wishlists WHERE person = '" & request.form("owner") & "';"


--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
Stop Spam Email Mining from your web pages with SpamStopper
http://www.websunlimited.com/order/product/SpamStopper/spam_stopper_help_dir.htm
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible
 
N

ND Viste

This produced

Error:'document.forms.0.owner' is null or not an objec

Now what

Thanks for your patience and help

Norm
 
M

MD Websunlimited

Of course. It is sample code with the names of the object pulled out of the air. Use the actual name of the form field.
 
N

ND Viste

Per my last post, I still get the distinct impression that FP 2003 has a bug in its DRW "where" clause using a form field. Could you please review the last one? I have installed Office SP 3. There have been some suggestions that SP 3 doesn't go well with DRW. Any thoughts on that

Thanks

Norm
 
M

MD Websunlimited

There is a probelm in the DRW based upon the KB articles that was not the problem that is being addressed here.

--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
Wish you could calculate form field totals? Well, you can with Form Calculator
http://www.websunlimited.com/order/Product/FormCalc/formcalc.htm
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible

ND Viste said:
Per my last post, I still get the distinct impression that FP 2003 has a bug in its DRW "where" clause using a form field. Could
you please review the last one? I have installed Office SP 3. There have been some suggestions that SP 3 doesn't go well with DRW.
Any thoughts on that?
 

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

Similar Threads


Top