Setting up stored procedures
TaskMan can execute stored procedures directly, without going through the IDO layer. To do this,TaskMan bundles the stored procedure in a transaction.
This example shows the steps to set up a stored procedure that runs through TaskMan from a form:
- Open the Background Task Definition form.
-
Specify this information:
- Task Name
- Specify AddProcessErrorLogSp.
- Task Description
- Optionally, specify a task description.
- Executable Type
- Select SP.
- Click Save.
- Close the Background Task Definition form.
- Open your form in Design Mode.
- Add a Button component.
-
In the Component > Properties tab, specify this information:
- Name
- Specify TestSP.
- Caption
- Specify sTest.
-
Create an event for the TestSP button:
- In the Component > Events > Primary field, click the ellipses (…) button.
- In the Event Handlers dialog box, click New.
-
In the Event Handler Properties dialog box,
specify this information:
- Event
- Specify RunSP.
- Description
- Optionally, specify the event description.
- Type
- Select Run Background Task.
- In the Parameters field, click the ellipses (…) button.
-
In the Event Handler Parameters dialog box,
specify this information:
- Error Message
- Specify mBackendMessage.
- Success Message
- Specify sSubmitted.
- Click Type Specific Parameters.
-
In the Edit Background Task Name and Parms dialog
box, specify this information:
- Task Name
- Specify AddProcessErrorLogSp.
- Task Parms
- Specify
BG~TASKID~,FV(TestMessage).Note: The FV keyword tells the application to enclose the value of TestMessage in single quotes. The BG~TASKID~ substitution keyword is replaced at run time with the task number.
- Click OK.
- Verify that RunSP is the primary event for the TestSP button.
- Save the form.
- Add an Edit component with a variable called TestMessage as the data source.
- Save the form.
- Exit Design Mode.
-
Specify a message in the TestMessage edit box and then
submit the task.
The system displays a message box that says: Submitted.
-
Open the Background Task History form.
When the task completes, the test message shows up in the event log.