Using the Query String portion of a URL is a useful method to pass information to a new document. For example when creating a new repsonse document:
Getting this value would be relatively easy. However, if the Query String consisted of multiple sets of arguments it gets a little more complicated. This method makes it simple to find a value in your form, using Formula language.
First thing to do is to create two Computed For Display, Multi-Value, Text fields with New Line to separate and display entries. I usually put these in to a Common Fields subform so that they are available in every form I use, just in case. This is also a good place to put the "Query_String" and "Query_String_Decoded" fields. Make these Computed For Display with a value the same as their name. These fields MUST appear on the form somewhere in order for Domino to be able to reference them.
The first field is called "ArgNames" and its formula is:
The second field is called "ArgValues" and its formula is:
Note: We have used Query_String_Decoded here and not, the more well known, Query_String CGI variable. I won't patronise you by explaining the difference...
Now that we have our lists of parameters we can use them throughout our forms. Let's say we have a field called "FirstName", whose default value we want to get from a parameter called "fName" in the URL. Place the following in to the Default Value event of the field:
If the "fname" parameter is in the "Query_String" portion of the URL then its corresponding value is extracted from the "ArgValues" field. If not then a blank "" will be added.
Note: In R5 there is a new "un-documented" @Formula called @GetMembers.
@GetMembers( sourceList; start; count)
sourceList = List from which you want to obtain value
start = position in list to start getting items (number)
count = number of items to return (number)
So, in the above example the code would then be simplified to:
REM "Check that the parameter exists";
@If(pos>0; @GetMembers(ArgValues; pos; 1); "")