Define SQL Functions

Here you can add new fields computed through row functions or aggregate functions. If you not need to add any function, you can skip to next step.



You can specify any SQL function. You can enter any code you wish. Clearly the syntax you use must be recognizable by the DBMS.

There are some placeholders <1>, <2>, ... these represents the operand fields that are used in the function. On the bottom right is a "slider control" containing the operand to use. You can add any number of operands. You can change anytime the operands by arrow icon near each operand. The reason why we use placeholder is that you can save your function and reuse it with different operands in other Data Sources.

You can rename or reorder your query fields. The names you use here will be used in the query after the keyword "AS" in the final query. Also the ordinal of the new query fields will reflect the order which is indicated here. To change a query field ordinal, just drag it or use the arrow buttons, on the right side of the query-field treeview. The nodes in the query-field treeview show the names of the query fields, and the subnode shows either the original field or the SQL function. (Actually the program consider a simple field as particular a function, say an "identity" function.)



When you define a function, one thing you should be particularly careful is to specify, through the specific radio button, if it is an aggregate function (examples: of aggregate functions are: count, avg, sum, that is function which results in a single aggregate value for all records with same dimensions) or it is a row function (example: Quantity * Price, which results always in one value for each record). The program need this information because is letting you specify any script as SQL function. (The indication that the specified function is an aggregate function will result, if necessary, in "Group By" statements.)

If you wish you can test your function. In case, you can also browse the test code and change if necessary.