Mapping Procedure Parameters
Parameter mapping is the key component of a procedure's definition. Parameter
mapping links the attributes or fields in your host application model with parameters
in your procedure, which are then used by the procedure to select, update, insert,
or delete host data.
There are three types of parameters:
- Filter parameters Identify the records you want to select,
update, or delete.
- Output parameters Contain data that is to be returned from
the select procedure.
- Data parameters Fields or attributes to update or insert.
The type of parameters that you map depend on the type of procedure you are
creating. The Tables dialog box and the Procedure Editor provide different options,
depending on the type of procedure you are creating.
- Select procedures Require a filter parameter to
identify the records to select and output parameters that return the requested
data.
- Update procedures Require a filter parameter to
identify the records to update and data parameters that identify the attributes
and/or fields to be updated.
- Insert procedures Require data parameters that identify
the attributes and/or fields that are inserted.
- Delete procedures Require a filter parameter to
identify the records to delete.
Special Mapping Options
When using recordsets in a procedure, you may want to further refine which
records are returned. Or, you may find that the filter parameter you use to
retrieve host data is not itself available as an attribute or recordset field
that can be returned to a querying application. Here's how to solve these two
situations.
Comparing parameters to recordset fields enables you to perform finely detailed
filtering of data that a procedure retrieves from a recordset. This makes it
possible to create complex procedure logic capable of sophisticated data manipulation.
Only the records that satisfy all comparison mappings are retrieved.
Use the Recordset tab in Procedure Editor to further refine how Host Integrator
retrieves data from recordsets.
These instructions assume that you have already inserted the recordset. If
you have not done so, follow the instructions on inserting
a recordset into a procedure.
To compare a filter parameter to a recordset field for a SELECT procedure:
- Click the needed procedure in the Tables and procedures box in the
Tables dialog box.
- Click Procedure Editor to open the Procedure Editor.
- Click the recordset containing the fields you want to compare to filter
parameters.
- Click the Recordset tab; on the Records tab, select Fetch/Update
records as the Action to perform.
- In the Records section, specify which matching records to retrieve
from the recordset:
- Select First matching record only to return the first record
that matches the filter. If no matching records are found to satisfy the
query, the procedure fails. If defined as First matching record only,
the operation that leads away from the parent entity may reference fields
in the recordset.
- Select All matching records to return all the records that match
the filter. Only the operation that leads away from the recordset may
reference fields in the recordset.
- In the Record filter section, click the Compare field to parameter
column next to each recordset field that you want to use to filter the data
that will be retrieved when this procedure runs; select a filter parameter
from the list.
When the procedure runs, the parameter is compared to the data retrieved from
the recordset; only the data matching all the compare filters is returned to
the querying application.
In some cases, a filter parameter you use to retrieve host data is not itself
available as an attribute or recordset field that can be returned to a querying
application. To solve this problem, you can map a filter parameter to an output
parameter.
To map a filter parameter to an output parameter:
- In the Tables dialog box, click the needed procedure in the Tables and
procedures box.
- Click the Advanced button beneath the list of output parameters to open
the Parameter to Parameter Mapping dialog box. The output parameters for the
current procedure are listed in the Output parameter column.
- Click the Filter parameter column next to the output parameter you
want to map. Then, click the list to select the filter parameter
you want to map to the output parameter.
- Repeat step 3 for each filter parameter you want to map to an output parameter.
© 1999-2007 Attachmate Corporation. All rights reserved. Terms
of Use.