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
--
SeanDavis - 22 Oct 2007
Answer
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