|
This passes the primary key value to the destination page via the URL. Even though the argument is
called "ID", what is passed to the URL is an XML element that specifies the full primary key of the
record. If the primary key is composite key, the composite key is passed as an argument.
If the ID of the field is a single integer value, you can use the "FV" URL Parameter type to pass
the value to the URL. However, if you later change the Id to a more complex key, your existing pages
will not work correctly. As such, we recommend always using the "ID" or "PK" URL Parameter types to pass
primary keys to other pages via an XML encoded composite key structure.
Passing Foreign Key Values Between Pages in URL’s
In the following example, the URL uses an argument {0} to indicate the substation of the first argument.
The argument itself is specified in the URL Parameters field as FK:FK_Employees_Employees. This means that
the parameter {0} will be substituted with the foreign key (FK) value as specified by FK_Employees_Employees.
The FK_Employees_Employees name indicates a foreign key link between the employee table and another record in
the Employees table (the manager of the employee).
| Tag Property |
Setting |
| Button Text |
Add |
| Button Command |
Redirect |
| URL |
./EmployeeFKLink.aspx?Employee={0} |
| URL Parameters |
FK:FK_Employees_Employees |
Passing Virtual Primary Keys in URL’s
If you are using a database view or custom query (defined in Iron Speed Designer) as the source
of data, make sure that the database view or custom query has a Virtual Primary Key (VPK) defined.
(Virtual Primary Key functionality is only available in Iron Speed Designer Enterprise Edition).
If a virtual primary key is not defined, then your application will not be able to access the ID or
the record or any field within the record since there is no "handle" available to read the record from
the database. As such, passing a parameter such as ID or FV:EmployeeName will not result in the value
being substituted for the parameters and you will see the URL still contain {0}, {1}, etc.
Passing Composite Key Values in URL’s
Most database tables have a single primary key such as an Id field. But, some tables may have a
composite primary key such as a Customer table with First Name and Last Name as a composite key.
In this case, you must pass the composite key in the URL as an XML structure containing both elements
of the composite key, e.g., the first name field as "Fred" and last name field as "Jones". This is why
Iron Speed Designer passes keys in an XML structure as the default.
The composite key XML structure is:
"cv" is the column value. For composite keys, your <key> structure will have several entries,
one for each field in the composite key.
"c" is the column (field) name.
"v" is the column value, typically a numeric ID value or a text string.
If you are not using composite keys, you can change this very easily to a single field primary key by
passing FV:Id instead of ID (PK). The differernce is that you are passing the field value of the "Id"
field instead of the ID of the record. Make sure you spell the case of the field properly (e.g., Id, id,
ID, iD or whatever) in the URL Parameters on the Bindings tab of the Properties dialog box for the button
or other control.
|