WebGUI
      Click here to register.
      
Sprechen Sie WebGUI? Parlez vous WebGUI? Se habla WebGUI? Spreekt u WebGUI?

Do you speak WebGUI? Please help us translate WebGUI into your language.


SQL Macro

^SQL();
A one line SQL report. Sometimes you just need to pull something back from the database quickly. This macro is also useful in extending the SQL Report wobject. It uses the numeric macros (^0; ^1; ^2; etc) to position data and can also use the ^^rownum; macro just like the SQL Report wobject.

Examples:

^SQL("select count(*) from users","There are ^0; users on this system.");

^SQL("select userId,username from users order by username","<a href='^/;?op=viewProfile&uid=^0;'>^1;</a><br />");

If there are more numeric macros than selected columns in the SQL report the extra macros will be discarded.

The rownum macro, ^rownum;, begins counting at 1.

This Macro may be nested inside other Macros if the text returned does not contain commas or quotes.

Note: that macro is not enabled by default and should be manually enabled in  /data/WebGUI/etc/xxx.conf by adding  "SQL" : "SQL" line to "macros"  area.

 

Another Example:

^SQL("select p.fieldName, v.value from metaData_values v, metaData_properties p where p.fieldId = v.fieldId and v.assetId = '<tmpl_var assetId>' order by p.fieldName","<b>^0;</b> ^1;<br/>");

Output:

Author First Name Barbara
Author Last Name Nussbaum
Publication Date 03/16/06
Publication Type Merchants Of Vision

Keywords: