This document describes the use of the Bizweaver SQL Command tool.
This document is intended for developers of Bizweaver workflows.
Knowledge of T-SQL (Microsoft SQL Server) or SAP HANA coding is required to use this tool.
The following pages contain additional information that may help develop Bizweaver workflows using the SQLCommand tool.
Global connections required to access a database(s) that is needed must be created before this tool can be used.
SQL Server versions 2008 and higher are supported as well as SAP HANA databases. The SQL connection setup process is described in the SQL Connections section.
Four SQL Server command types are supported:
Only the Reader function is supported for HANA databases at this time.
Standard SQL Server or HANA syntax is used for the commands. The SQL statement's basic syntax is validated when the [OK] button is clicked. If the statement is not valid, an error message is displayed, but the step is saved as-is.
The following shows the same SELECT statement as illustrated above but with a variable in the WHERE clause.
SELECT CardCode, CardName FROM ocrd WHERE CardCode = 'WorkFlow(Variables).Get(CardType)'
When saving a workflow or opening the SQL/HANA tool or the workflow, the reader command type will validate the written query. This executes the query against the connected database. There is the ability to have Non-query commands written using the Reader command type. This will execute the statement against the database. If a Create, Update, Insert, Truncate or Delete (any SQQL/HANA statement that affects a change to any data) is written, the command will execute and be run against the connected database if the workflow is saved or the tool or workflow is opened
For SAP Business One Users: Updates to standard SAP Business One tables should not be done directly using insert, update, or delete. These updates should be done using the Mapper & SBO Updater tools.
This option is included for compatibility with older versions of Bizweaver and is no longer used. The same thing can be accomplished using a “Non-query” operation, as illustrated below. The SQL statement will be the same.
This command can be used to execute a SQL Stored Procedure that does not require parameters. In this case, the “exec” statement is not used. All that is required is the name of the procedure. In most cases, it is probably easier to simply always use the Non-Query option to avoid confusion. The use of the Non-Query option is described above.
While there is a “Stored Procedure” command in the SQL Command tool drop-down menu, its use is currently limited as it does not support the use of input parameters. To address this, the Non-Query command can also be used to execute stored procedures that include parameters for execution. In this case, the “exec” statement must be included in the command. The parameters are passed using standard SQL Server syntax. For example, assume a stored procedure that includes two parameters. The SQL statement would be:
EXEC Stored_Proc_Name parm1, parm2
Variables representing values from previous steps can be used in the statement as needed. Press <F4> for a list of available variables.
'WorkFlow(GetData).Get({FIELD_ItemCode})'
Bizweaver version 2.3 introduces the Execute option in the SQLCommand tool. This option allows you to test SQL functions without running through the entire workflow. It also allows you to test SQL steps where the input involves variables from previous steps. The example here uses the following SQL statement.
To invoke this option, click on the “Execute” link in the lower-right corner of the tool window. The display changes to the test view.
Test view
The [Result] tab displays the results of the SQL statement. The statement can be modified in this tab, but selecting Execute again will revert all changes to the original query.
WHERE t0.CardCode = 'WorkFlow(Variables).Get(CardCode)'
Changes in the [Result] tab DO NOT automatically carry back to the [SQL] tab. If you make changes in the [Result] tab that needs to be in the “real” SQL statement, you must add them manually. Once the test is modified, you should copy the code and then exit the test view and past them in the SQL section for the best results.
| Name | Description |
|---|---|
| CommandType | The command type chosen in the SQL tool ex. Reader, Non-Query |
| DataSourceFields | The fields pulled from the data source will only show up when executing the query in the SQL tool and not during a test run |
| DataSourceResultsTable | The results from executing the query in the workflow. Will only show up when executing the query in the SQL tool and not during the test run |
| QueryString | The current query that is being executed |
| SQLCommand | Used for an older version of Bizweaver no longer returns a value |
| SQLResultsCount | The total amount of records that were retrieved during a query |
| StepMessage | During a failure the reason for failure will be populated here |
| StepStatus | True or False |