|
There are two Workbooks defined for the demo, Articles and Formulas.
Articles
In this example, the SQL 2 Excel Component has been configured to generate one Excel Workbook containing two worksheets. Each worksheet runs it's own SQL query. The two queries that builds the worksheets are defined as below.
Latest Article
SELECT ID, TITLE, CREATED, CONCAT('http://joomla-r-us.com/index.php?option=com_content&view=article&id=',ID) AS URL FROM #__content ORDER BY ID DESC LIMIT 0,20
Popular Articles
SELECT ID, TITLE, HITS, CONCAT('http://joomla-r-us.com/index.php?option=com_content&view=article&id=',ID) AS URL FROM #__content ORDER BY HITS DESC LIMIT 0,10
The downloadable Excel file works in both Microsoft Excel as well as in OpenOffice Calc. A screenshot from OpenOffice Calc of this example is shown below.
 Click on image
This example is included in the SQL 2 Excel Component installation. Click on the "Add Sample Data" button in the SQL 2 Excel Control Panel to add this example to your local installation.
Formulas
The second example shows how you can write formulas into columns of your data output. The SQL Query that is excuted for this example looks like this:
SELECT ID, '=A{ROWID}*2' AS X2, '=A{ROWID}*10-A{ROWID+1}' AS RES FROM jos_content ORDER BY ID LIMIT 0,10
The {ROWID} is a substituted with the current row ID in formulas. See SQL 2 Excel - Formulas for more info about how to write formulas.
Formulas are NOT evaluated in the preview mode as you can see from the demos on the left hand side. Excel or OpenOffice Calc evaluates the cells containing formulas when the user opens the downloaded Workbook.
For more information, please check out the SQL 2 Excel Tutorial and the screenshots below.
Any questions, please us our forum!
 |