Stored Procedure Calls

With the help of the GAPTEQ component “Data Processor”, it is possible to call stored procedures on the SQL server, receive return values, save them and use them further.

In this article you will read the following content:

Define parameters for SQL statement

Configure the Data Processor component

Execute stored procedure

To call an SQL statement, parameters are first defined and filled. The return values (output parameters) of the procedure are stored in variables. This allows you to check whether the procedure was executed successfully and whether the return values can be output or processed further.

The example here shows a parameter-controlled procedure call:

TD_FT_PDF_DataProcessor_Screenshot_1

1. Define parameters for SQL statement

  • To do this, go to the “SQL statement” tab in the GAPTEQ Designer menu bar above via the “New” button.

TD_FT_PDF_DataProcessor_Screenshot_10

  • Under “Parameters”, define all the parameters that you need to call up the procedure.
TD_FT_PDF_DataProcessor_Screenshot_2
  • The correct call of the stored procedure with all parameters is specified in the SQL statement editor window.

TD_FT_PDF_DataProcessor_Screenshot_3

2. Configure the Data Processor component 

  • Drag and drop the “Data Processor” component into the page.
  • Select the previously created and saved SQL statement in the properties of the component via “Select”.
TD_FT_PDF_DataProcessor_Screenshot_5
  • Parameters defined in the SQL statement are supplied with values via “Data links”.

TD_FT_PDF_DataProcessor_Screenshot_6

Actions

  • Events under Actions can optionally be used for program control and error handling.
    • Executed - Event is triggered when the query is completed.
    • execStarted - Event is triggered when the query is executed
    • execError - Message is issued if the query could not be executed successfully.


3. Execute stored procedure 

Note! A stored procedure can now be executed by various events of a component. The return values of the procedure are also output using a component (e.g. edit box).  


In our example, the stored procedure is triggered by the clicked event of a button with the exec() action of the Data Processor.

TD_FT_PDF_DataProcessor_Screenshot_8

The return value of the procedure is then output - in our example - in an edit box (inputResult.setValue). The Data Processor performs this task independently if the query has been executed successfully (Event: executed).

TD_FT_PDF_DataProcessor_Screenshot_9