The Run Procedure action is a more powerful alternative to Set Value which can optionally return results to dbFront. Depending upon the database capabilities and configuration, you could: perform a specialized calculation, send an email, create a report document or even start a backup.
- Procedure: The name of the database procedure,
- Parameters: The list of fields to pass to the database procedure.
- Result: The expected result type and how it should be processed.
Creating the Action Button
The following steps will create a Run Procedure action button in dbFront:
- Open the table from which you will want to call the procedure,
- Open the Table Preferences and create a new button in the "Action Buttons" tab and Save,
- Click on the gear icon beside the new Action Button and complete the button setup including the Caption and Visibility,
- Change the "Action Type" to "Run Procedure", (this will immediately add a new "Procedure" tab to the dialog)
- Switch to the "Procedure" tab,
- Enter the procedure name,
- Select the fields that should be assigned to the procedure,
- Set the result type to 'Automatic',
- Save the new button.
Once saved, the button may appear disabled if no record is selected and if one or more table fields were selected as parameters.
Stored procedures can optionally have a final Select statement return results.
In the Procedure tab of the Action Button preferences you can specify the Output Format:
- (Discard Results): This will cause the procedure results to be discarded.
- Automatic: This will cause dbFront to check the returned value and select HTML as the output format if a single column and row was returned, , or TABLE if multiple rows and columns were returned.
- Report / Export (NEW): Pass the returned records to the Quick Report / Export engine,
- Server Directed (NEW): A list of actions as prepared by the stored procedure,
- Simple Message: Return the value from the first column and row as a simple message.
- Simple Html: Return the value from the first column and row as HTML that will be shown in a dialog.
- Simple Table: Build and display an HTML Table using the result set.
Report / Export (NEW)
The Report / Export output format causes the Stored Procedure output to be sent directly to the Quick Report / Export engine. This allows for the creation of Excel or CSV exports and template-based Quick Reports. Quick Reports can be viewed as Html, downloaded in PDF format, or sent directly to a Server attached printer.
The formatting of Quick Reports is determined by the selected template. For more details see: Creating Report Templates
Server Directed (NEW)
The Server Directed output format is a way for stored procedures to dynamically send instructions to dbFront. The action list is returned as a multicolumn select with the first column named "action".
The supported actions are: OpenTable and OpenUrl.
- OpenTable: Open the table specified in the column "TableName". The column "Target" specifies where the table will be opened. Optional Target values are: [Redirect, Dialog or NewTab].
The procedure should return:
- OpenUrl: Open the Url specified in the column "Url". The column "Target" specifies where the table will be opened. Optional Target values are: [Redirect, Dialog or NewTab].
The procedure should return:
- Can't load '%procedurename%' parameters. The stored procedure '%procedurename%' doesn't exist.
The three most likely sources for this error are:
1. Incorrect procedure name,
2. Missing schema name for procedures saved in non-default schemas,
3. Missing security. Run [Grant Execute]
For more help or details on creating Action Button see: Action Buttons