Logi Info developers working with SQL databases often run queries to retrieve data and issue other SQL commands.
The following topics introduce you to the DataLayer.SQL element:
- DataLayer.SQL Attributes
- Retrieving Data with DataLayer.SQL
- Using DataLayers to Retrieve SQL Data
- Using SQL Parameters
- Writing Data to the Database
- Using Studio's DataLayer Wizard
The DataLayer.SQL element can be used as a child of Data Tables, charts, and many other elements.
The text of a SQL query can be entered directly into the DataLayer.SQL element's Source attribute, or generated using the special SQL Query Builder tool, which can be accessed by clicking the browse button at the end of the Source attribute. This tool allows developers to create a correctly-formatted SQL query using a graphical interface. You can also test your query in the tool, and view the resulting data.
All valid SQL queries can be executed using this element. The number of rows returned can be controlled using the Maximum Rows attribute.
Process Tasks can make use of a similar element, Procedure.SQL, to retrieve data and write it back to the database.
DataLayer.SP allows you to use SQL Stored Procedures, which provides better protection against SQL injection attacks and better performance.
Developers interested in issuing queries to three-dimensional datasources, such as cubes, for use with two-dimensional visualizations, can make use of Studio's MDX Query Builder tool to formulate valid queries. For more information on the MDX Query Builder, see Using Logi Studio.