4.5.4 Editing a Query SQL String

To manually edit the SQL string for a query, follow the steps below:

1. Open the query for editing, as described in Editing a Query.

2. Click the SQL String tab at the bottom of the editor. This opens the SQL string for editing.

 

To change back to the graphical query view, click the Main Query tab.

3. (Optional) Select the 'Parse SQL' checkbox to allow Style Studio to automatically parse the SQL string and reconstruct the graphical query view. This is the default.

Note, however, that due to database variations, the parser may not be able to parse all valid SQL statements. In such cases, you will be asked whether you want to keep the change or modify the query. In either case, manually entered SQL always overrides the query graphical query definition. (This allows any query to be constructed in Style Studio.) For very complicated SQL statements that are slow to parse, you may wish to disable the 'Parse SQL' option.

4. Click the 'Save' button in the Style Studio toolbar to save your changes.

You can add query variables to the SQL string using the $(var) construct, where var is an arbitrary variable name. This variable will be translated into a SQL variable and the value will be provided at runtime.

You can also specify a special string replacement variable with the $(@var) construct. This allows you to dynamically construct the SQL string, through scripting, in order to satisfy complex business requirements. For example, you can dynamically determine the table from which to select at runtime. To do this, define a partial SQL string, such as “select id from $(@var)”. Then create a runtime script to replace the variable var with a table name such as 'customers' or 'prospects'.

<< 4.5.3 Editing a Query © 1996-2013 InetSoft Technology Corporation (v11.5) 4.5.5 Creating a Local Query >>