assistance-engine/docs/developer.avapframework.com/appendices_15.md

1.4 KiB

addParam()

The addParam() command retrieves the value associated with a specific key from the query string of the current request and assigns this value to a target variable. This command is useful for extracting values from query parameters in an HTTP request and storing them in variables for processing.

Parameters

  • param Type: value Description: The key of the query string whose value you want to retrieve. It should be a value that represents the key in the query string.
  • variable Type: var Description: The variable in which the retrieved value from the query string will be stored. It must be a variable that will receive the value associated with the specified key.

Command Flow

Usage Example

Suppose the query string of the current request is ?user=alice&age=30 , and you want to retrieve the value associated with the key "user" .

// Variable definitions
userName = ''

// Call the command to retrieve the value for the "user" key and assign it to the variable
addParam("user", userName)

// Return the retrieved value through addResult
addResult(userName)

Given the query string ?user=alice&age=30 , the addParam() command will retrieve the value "alice" associated with the key "user" and store it in the userName variable. The userName variable will be returned through addResult(userName) , resulting in the following output:

"alice"