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 from a form using TaskMan:

  1. Open the Background Task Definition form and execute Filte-In-Place.
  2. Initiate a new record, if needed.
  3. Specify this information:
    Task Name
    Enter AddProcessErrorLogSp.

    This is typically the name of the stored procedure.

    Task Description
    Optionally, specify a helpful task description.
    Executable Name
    Provide the name of the stored procedure.
    Executable Type
    Select SP.
    Maximum Concurrent
    Specify the maximum number of concurrent instances of this task you want TaskMan to allow.

    The default value is 20.

    Valid values are positive integers. A value of -1 means any number of concurrent instances of this task are allowed to run, up to other limits imposed on all tasks.

    Caution: 
    Do not attempt to use a value of zero (0), as it disables the task completely.
    Isolation Level
    Select the transaction isolation level to use when running stored procedure tasks (Executable Type is set to SP) or report stored procedures (Executable Type is set to RPT):
    • COMMITTED: All queries run from this stored procedure see only data for which the query can get a shared lock. No reads of uncommitted data are performed.
    • UNCOMMITTED: All queries run from this stored procedure can read uncommitted data. Use this option carefully, since it can display data that has not yet been committed in the database.

    If no isolation level is set in this form, the stored procedure uses the global Collection Read Mode value from the Process Defaults form. If that value does not exist, the stored procedure uses COMMITTED as the transaction isolation level.

  4. Save, and close the Background Task Definition form.
  5. Open your form in the designer (Web Designer in a web client or Design Mode in the Windows client).
  6. Add a Button component.
  7. In the Component > Properties sheet, provide this information:
    Name
    Enter: TestSP
    Caption
    Enter: sTest
  8. Create an event for the TestSP button:
    1. In the Component > Events sheet, next to the Primary field, click the ellipses (•••) button.
    2. In the Event Handlers dialog box, click New.
    3. In the Event Handler Properties dialog box, provide this information:
      Event
      Enter: RunSP
      Description
      Optionally, provide a helpful event description.
      Type
      Select Run Background Task.
    4. Next to the Parameters field, click the ellipses (•••) button.
    5. In the Event Handler Parameters dialog box, provide this information:
      Error Message
      Enter: mBackendMessage
      Success Message
      Enter: sSubmitted
    6. Click Type Specific Parameters.
    7. In the Edit Background Task Name and Parms dialog box, provide this information:
      Task Name
      Enter: AddProcessErrorLogSp
      Task Parms
      Enter: 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 runtime with the task number.
    8. Click OK repeatedly until you are back in the Events tab.
    9. Verify that RunSP is the primary event for the TestSP button.
  9. Save the form.
  10. Add an Edit component with a variable called TestMessage as the data source.
  11. Save the form.
  12. Exit the designer.
  13. Specify a message in the TestMessage Edit component and then submit the task.
    The system displays a message box that says: Submitted.
  14. Open the Background Task History form.
    When the task completes, the test message shows up in the event log.