The SQL export makes it possible to write your own SQL queries and to fully customize the query used to run the export. The queries can be extended with placeholders, this way you can make the exports really dynamic.
Options
SQL Query
The query field is where you write the actual query to run. The query can contain placeholders, the placeholders you can completely define yourself. Multiple queries can be added, and they are run consecutively.
SELECT u.name, u.email, u.lastVisitDate
FROM #__users as u
WHERE u.id = {userID}
In this example there is a placeholder for {userID}
Sheet name
The sheet name is primarily used when exporting data into XLSX files as these files can contain multiple sheets, this lets you set a name for that sheet. Further RO CSVI uses this to determine which fields
belong to which query.
Placeholders
Placeholders can be added to make the queries more dynamic. Setting the values in the template does not really make it dynamic, but you can pass values via the cron command or via the URL when exporting it on the website.
Placeholder
Enter here the placeholder as you will use it in the query, for example {userID}.
Value
The value that needs to be used as replacement for the placeholder, for example 15874.
After the placeholders have been applied, the query will look like this:
SELECT u.name, u.email, u.lastVisitDate
FROM #__users as u
WHERE u.id = 15874
Export formats
Multiple queries can be exported but this is generally only useful when exporting to XLSX format as this has the option for multiple sheets. Here is an overview of what happens with each format:
CSV
Each query result is added to the CSV file below the previous query
XML
Only nodes that match nodes specified in the XML layout are exported
HTML
Each query result is added to the HTML table below the previous query
XLSX
Each query result goes into a designated sheet