Passing Field Values in URL’s

Passing Field Values Between Pages

The parameters passed as part of the URL are not limited to the primary and foreign keys.  You can pass any field value, as well as display values using the URL Parameter types to pass any field value to a page via its URL.  For example, to pass the first and last names from an Employee record, specify the URL and the URL Parameters as follows:

Tag Property

Setting

Button Command

Redirect

URL

ShowEmployeePhotoRecord.aspx?First={0}&Last={1}

URL Parameters

FV:FirstName,FV:LastName

Advantages and limitations

There are many contexts in which passing data from one page to another via the URL is a convenient means of transferring data.  By dynamically constructing the URL, the component can choose the page to which the user will be redirected.  Also, using URL parameters, the component can pass data to the new page.  This works even for components on different pages.  However, because URLs are limited to a browser-specific maximum length, the quantity of data that can be passed to a new page is fairly limited.  Also, a redirect will cause the current page to stop processing immediately.  Therefore, some situations may require a combination of event interaction and page redirection.

Field values vs. display values

The display values might be different than the field values.  For example, for Boolean fields, the field value might be 1 or 0, but the display value might be True or False.

Example

This example passes the Id’s of two products to a page to show how parameter passing works.  Two products are displayed as a result of this example.

Two different products are selected for display by passing their respective primary key values to an application page via URL parameters.

Step 1:  Create a new layout page file containing two products as follows:

 

<div align="center">

 <GEN:Record Name="Product">

  <table cellpadding="5" style="border-collapse: collapse" border="1" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0">

   <tr style="font-family:Verdana; font-size:10px">

    <td align="right">Product Id:</td>

    <td style="font-weight: bold">

     <GEN:FieldValue Name="ProductId" />

    </td>

   </tr>

   <tr style="font-family:Verdana; font-size:10px">

    <td align="right">Product Name:</td>

    <td style="font-weight: bold">

     <GEN:FieldValue Name="ProductName" />

    </td>

   </tr>

   <tr style="font-family:Verdana; font-size:10px">

    <td align="right">Unit Price:</td>

    <td style="font-weight: bold">

     <GEN:FieldValue Name="UnitPrice" />

    </td>

   </tr>

   <tr style="font-family:Verdana; font-size:10px">

    <td align="right">Units in Stock:</td>

    <td style="font-weight: bold">

     <GEN:FieldValue Name="UnitsInStock" />

    </td>

   </tr>

  </table>

 </GEN:Record>

</div>

Step 2:  In the tag’s Properties dialog, set the query as the Products table.  Also specify the URL parameter as P1:

Tag Property

Setting

Code generation tag

Product

Table, view or query

Products

URL parameter

P1

Note: this can be any variable name you wish.  It will be bound at run-time to the ID of the specific record passed in via the URL.

Step 3:  Repeat this step for the second Product code generation tag.  This time specify a different name for the query string parameter such as P2.

Step 4:  Set the Query properties of the FieldValue tags to their respective database fields.

Step 5:  Build and run the application.

See Also

Using URL Parameters

URL Query String Format

Passing Primary and Foreign Key Values in URL’s

Example: Passing a Record ID from an Add Record Page