Another option in providing dynamic query parameters to your Autofill Queries is that which allows you to specify parameter names and values in HTTP requests used to download forms from Formatta E-Forms Manager. This option allows you to provide forms to users such that they are already populated with data from specifically-targeted records in a database at the time the form is downloaded from Formatta E-Forms Manager.
To use this type of Autofill, you must write a SQL query that uses a token which can be substituted for the actual value provided in the HTTP query string. This is done using the special $REQUEST token in your query, followed by the name of the query string parameter that identifies the actual data element that will be passed in.
For example, the query below will use the value from an HTTP request's query string identified as articleID as a SQL query parameter:
SELECT article_name, description, publish_date FROM articles WHERE article_id = $REQUEST.articleID
An actual HTTP request string with query parameters that would make use of this query would then look like:
http://myserver:8080/efm/catalog/getform?fref=aarw493ab2wrt&articleID=2
The example URL above consists of the published form's unique download URL (available in the form's properties in the Formatta E-Forms Manager catalog) followed by an additional query string name/value pair of &articleID=2. When the Autofill query is run, the Autofill Handler looks for a query parameter in the HTTP request named articleID and gets its associated value. So using this example, the resulting query will be run as:
SELECT article_name, description, publish_date FROM articles WHERE article_id = 2
Adhere to the following guidelines when using this type of query:
Make sure that you use the $REQUEST keyword in your SQL Query definition, followed by a dot then the name of the HTTP query string parameter you will be using to download the form.
Make sure that the HTTP request string is valid (get it from the form catalog), and that you append your Autofill Query parameter name and value to the end using the "&" symbol, followed by the same parameter name specified in the SQL query.
The HTTP request parameter name and SQL query's $REQUEST parameter name must match in spelling and in case.
You may use multiple data elements from the form in your query by using this special syntax for more than one of your query parameters, then assigning name/value pairs for each parameter in the download URL for the form.
When you specify an HTTP query string parameter as an Autofill query parameter using the $REQUEST syntax, make sure that you properly enclose the parameter in quotes if the query parameter is for a non-numeric column. If the query parameter is for a numeric column (as in the example above), then you may use it in your query without quotes.