Syntax
| SQL.RunDataMultiList QueryArray [, Params][, AlternativeTitle][, LayoutString]
| ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Description
| RunDataMultiList opens a window displaying the results of multiple SQL queries (VIEW, TABLE, or SELECT), where the data from these queries can be browsed but not modified. This method is ideal for situations where you want to view up to three tables or queries in a single window and establish relationships between them for synchronized viewing.
Each query is provided as an element of the QueryArray. Optionally, the Params array allows you to define how the tables are related by specifying the links (or joins) between them. It is essential to include a numeric prefix (1., 2., 3.) in the Params definitions to reference the corresponding tables from QueryArray. This ensures that the join conditions apply to the correct queries and that the relationships between the datasets are correctly established.
The method is similar to the “Data list” output option in the SQL Designer but allows for viewing multiple tables simultaneously, something that can only be achieved via scripting.
| ||||||||||
See Also
| other SQL.Runxxxxxxxx methodes, Datalijst.
| ||||||||||
Example
| Option Explicit ' Example of Multiple Data lists, related to each other ' ------------------------------------------------------- 'Query(0) = "SELECT * FROM Leveranciers" 'Query(1) = "SELECT * FROM InstalBase" 'Query(2) = "SELECT * FROM ArtikelLink" 'Params(0) = "1.Admin = 2.Admin AND 1.InstalBaseCode = 2.LevKode" 'Params(1) = "2.LevKode = 3.LevKode AND 2.Nummer = 3.LevNummer" 'Params(2) = {empty} because not applicable Sub Main() Dim Query(0 To 2) As String Dim Params(0 To 1) As String Query(0) = "SELECT * FROM Leveranciers" Query(1) = "SELECT * FROM InstalBase" Query(2) = "SELECT * FROM ArtikelLink" ' Define the relationships (joins) between the tables Params(0) = "2.LevKode = 1.InstalBaseCode" ' Link between Query 1 and Query 2 Params(1) = "3.LevKode = 2.LevKode AND 3.LevNummer = 2.Nummer" ' Link between Query 2 and Query 3 ' Run the multi-table query and present the results SQL.RunDataMultiList Query, Params, "Data Related", "My Data Related Test" End Sub | ||||||||||