19.0.0 released Nov 08, 2023
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  
if-task  
input-param  
request-body  
set-input  
set-req  
task-param    
See all
documentation


You are free to copy, redistribute and adapt this web page (even commercially), as long as you give credit and provide a dofollow link back to this page - see full license at CC-BY-4.0. Copyright (c) 2019-2023 Dasoftver LLC. Vely and elephant logo are trademarks of Dasoftver LLC. The software and information on this web site are provided "AS IS" and without any warranties or guarantees of any kind. Icons from table-icons.io copyright PaweĊ‚ Kuna, licensed under MIT license.