set-input
Purpose: Set or overwrite input parameters.
set-input <param name> = <param value>
set-input sets or overwrites an
input-parameter. <param name> is a string that holds parameter name and <param value> is a string that holds parameter value.
If an input parameter with <param name> already exists, it's value is overwritten with <param value>.
If an input parameter with <param name> does not exist, a new parameter is created and its value is set to <param value>.
Note that no copy of <param value> is made. If it will go out of scope before it's used, make a copy first (see
copy-string).
set-input is useful when input parameters supplied through a
request need to be altered or added-to so your code can process them more efficiently, to write less code etc.
Once set-input sets parameter value, using
input-param will obtain it as if it was provided through a request URL.
Note that
input-param creates a variable, so you cannot use it twice in the same scope. Typically, set-input is used to set input parameter values, while another code block or function will use input-param to obtain those values.
Examples
Set the value of input parameter named "quantity" to "0", which is also the output:
set-input "quantity" = "0"
...
input-param quantity
p-out quantity
Set the value of input parameter named "description" to "not available", which is also the output:
char *name = "description";
set-input name = "not available"
...
input-param description
p-out description
See also
Request information (
get-req input-param request-body set-input set-req )
SEE ALL (
documentation)