SQL Advanced
Kalipso - Form - Actions - Actions Description - Group Database - SQL Advanced
Last updated
Kalipso - Form - Actions - Actions Description - Group Database - SQL Advanced
Last updated
Runs the specified query in the specified database. This Action allows you to run online queries without having to add Tables to a Database Connection Profile.
Action available for the following operating systems:
Execution mode
Online - The query will be executed in the specified Database.
Database Connection Profile - Database Connection Profile where the query will be executed. It's not mandatory to have tables defined in the profile to be able to run this Action.
Offline - The query will be executed in the Local Database which holds all the offline Tables.
Clear Target When No Data is Returned - If this option is checked and no record is returned, all the Targets are cleared.
SQL Sentence <string> - SQL query to perform.
Targets
Column <unquoted string> - Name of the column to retrieve. This parameter is merely informative and has no impact whatsoever. What matters is the index of the Column. Therefore, this refers to the first returned Column.
Target <target> - Control or Variable where to save the value of the first Column.
nth Column <unquoted string> - Name of the column to retrieve. This parameter is merely informative and has no impact whatsoever. What matters is the index of the Column. Therefore, this refers to the nth returned Column.
nth Target <target> - Control or Variable where to save the value of the nth Column.
Consider the following Database Table, and the following Variables:
Products | ||
Code | Name | Stock |
1 | Coca Cola | 100 |
2 | Pepsi Cola | 400 |
3 | Pork Chops | 300 |
Variable | Type | Value |
VAR(0) | String | kalipso |
VAR(1) | Numeric | 0 |
VAR(2) | String | kalipso1 |
Consider that column Code is Numeric, column Name is String and column Stock is Numeric. Note that the table showing variables isn't a database table, its purpose is to show only the values and type of each variable.
Execution mode | Offline |
Clear Target Data | Yes |
SQL Sentence | "Select Name from Products" |
Clear Data | Yes |
Column | Target |
Code | VAR(0) |
Name | VAR(1) |
Stock | VAR(2) |
Result:
Variable | Type | Value |
VAR(0) | Numeric | 1 |
VAR(1) | String | Coca Cola |
VAR(2) | Numeric | 100 |
Execution mode | Offline |
Clear Target Data | No |
SQL Sentence | "Select Name from Products Where Products.Code=4" |
Clear Data | Yes |
Column | Target |
Code | VAR(0) |
Name | VAR(1) |
Stock | VAR(2) |
Result:
Variable | Type | Value |
VAR(0) | String | Kalipso |
VAR(1) | Numeric | 0 |
VAR(2) | String | Kalipso1 |
Notice that, as you can see in the examples above, variable types are enforced, except if there is no result of the select operation or when parameter Clear Data isn't selected.