Tags:
create new tag
view all tags

Question

I would like to use HTML form parameters in a SpreadSheetPlugin to set up some variables for a %DBI_QUERY{}% from the DBIQueryPlugin. I can't seem to find the correct syntax to use in %CALC{} to do something like this:

%CALC{"$SET(my_var,$IF(defined %URLPARAMS{'my_param' encode='entity'}%,%URLPARAM{'my_param' encode='entity'}%,'default_value'))"}%

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: MacOS 10.4.10
Web server: Apache 2.2
Perl version: 5.8.6
Client OS: linux x86_64
Web Browser: Firefox 2.0.0.5
Categories:  

-- SeanDavis - 22 Oct 2007

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

I think you could do what you're describing without the IF statement. If the URLPARAM is not defined, my_var would just be empty.

-- LynnwoodBrown - 22 Oct 2007

Ah, I was not at all clear. I need to have some logic somewhere to generate an SQL statement for a query. So, I would like to set variables to a default if they are not defined. And even doing a $SET with the value 1 doesn't seem to work, probably due to either an execution order thing or an embedded % thing. Not sure which.

-- SeanDavis - 22 Oct 2007

I just noticed that %URLPARAM has a default argument. That is what I was trying to recreate with the conditional statements. Sorry for the noise.

-- SeanDavis - 22 Oct 2007

That is correct. See VarURLPARAM.

-- PeterThoeny - 27 Oct 2007

Change status to:
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2007-10-27 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.