1 sql.toHTML
Generate a table HTML with the values obtained from:
- select (or union) in XSQL
- select in SQL nativo indicated between the tags nativesql
- vtable
- a xml of a sqlresponse
The columns which has defined an attribute with include will be converted to the value defined in the include.
<sql.toHTML
table-style='table-style'
table-titles='table-titles'
th-style='th-style'
th-colour='th-colour'
th-bgcolor='th-bgcolor'
convert='convert'
>
<in> ?
<vtable /> *
<soapsqlresponse /> *
</in>
<union /> ?
<select /> ?
<nativesql /> ?
</sql.toHTML>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Atable-style | string | Style for the table. | |||
Atable-titles | string | Tables from which the labels of thecolumns of the query are obtained. | |||
Ath-style | string | Style for the column titles. | |||
Ath-colour | string | wic_user.user_print_colour_head1 | Text colour for the column titles. If none is indicated, the one that the user has defined for the prints is used (Font colour of the headers wic_user.user_print_colour_head1). | ||
Ath-bgcolor | string | wic_user.user_print_bgcolor_head1 | Background colour for the column titles. If none is indicated, the one that the user has defined for the prints is used (Backgroung colour of the headers wic_user.user_print_bgcolour_head1). | ||
Aconvert | boolean | True | The columns that has defined an attribute with include will be converted to the value defined in the include at least that it is explicitly indicated through this attribute with the value false. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Ein | xml |
In clause to travel: vtable. A xml of a sqlresponse. |
|||
Evtable | xml | ||||
Esoapsqlresponse | xml | ||||
Eunion | xml | Query union in xsql. | |||
Eselect | xml | Query select in xsql. | |||
Enativesql | xml | Query select in native. |
Returns | |
---|---|
Type | Description |
string | Returns a table in HTML format with the data obtained of the indicated SQL query. |
Exceptions
sql exception ...
Error of sql.
Create a table in html, from a native code.
<xsql-script name='sql_sql2html1'> <body> <println> <sql.toHTML table-style='bgcolour: \#CCCCCC' th-bgcolour='azure'> <nativesql>SELECT cdiary FROM cdiary</nativesql> </sql.toHTML> </println> </body> </xsql-script>
When the colour of the table is introduced, you should note that the bgcolour value has to be preceded by '\'(scape character), so that the same RGB value will not be interpreted as a variable.
Create a table in html, from a tag code.
<xsql-script name='sql_sql2html2'> <body> <println> <sql.toHTML table-style='bgcolour: \#CCCCCC' th-bgcolour='azure'> <select> <columns>cdiary</columns> <from table='cdiary' /> </select> </sql.toHTML> </println> </body> </xsql-script>
When the table colour is introduced, you should note that the bgcolour value has to be preceded by '\'(scape character), so that the same RBG value will not be interpreted as variable.
Creation of a XML structure through a vtable.
<xsql-script name='sql_sql2html3'> <body> <vtable name='v1'> <column name='code' type='char' unique='true' /> <column name='name' type='char' size='25' /> <column name='number' type='integer' /> <column name='balance' type='decimal' scale='2' editable='true' /> </vtable> <vtable.insert name='v1'> <column name='code'>A</column> <column name='name'>Nombre AA</column> <column name='number'>0</column> <column name='balance'>12.9</column> </vtable.insert> <vtable.insert name='v1'> <column name='code'>B</column> <column name='name'>Name BB</column> <column name='number'>1</column> <column name='balance'>-17.99</column> </vtable.insert> <println> <sql.toHTML table-style='bgcolour: \#CCCCCC' th-bgcolour='azure' table-titles='cdiary'> <in> <v1/> </in> </sql.toHTML> </println> </body> </xsql-script>
Generate the following HTML table:
<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='0' STYLE='bgcolor: #CCCCCC'> <TR> <TH VALING='TOP' style='margin:0; border: 1px solid gray; font-weight:bold; colour: #000000; background-colour: azure;'>Diary</TH> <TH VALING='TOP' style='margin:0; border: 1px solid gray; font-weight:bold; colour: #000000; background-colour: azure;'>name</TH> <TH VALING='TOP' style='margin:0; border: 1px solid gray; font-weight:bold; colour: #000000; background-colour: azure;'>number</TH> <TH VALING='TOP' style='margin:0; border: 1px solid gray; font-weight:bold; colour: #000000; background-colour: azure;'>balance</TH> </TR> <TR> <TD>A</TD> <TD>Name AA</TD> <TD ALIGN='RIGHT' NOWRAP>0</TD> <TD ALIGN='RIGHT' NOWRAP>12,9</TD> </TR> <TR> <TD>B</TD> <TD>Name BB</TD> <TD ALIGN='RIGHT' NOWRAP>1</TD> <TD ALIGN='RIGHT' NOWRAP>-17,99</TD> </TR> </TABLE>
Create a table in html with the data obtained of the result of a soap call.
<xsql-script name='sql_sql2html4'> <body> <set name='m_response'> <soap.call url='http://localhost:80/soap/servlet/rpcrouter' uri='urn:SOAPSQLServer' method='executeSQL' user='demo' password='abcdemo' > <parameters> <parameter name='database'>demo_sports1</parameter> <parameter name='sqlstmt'>SELECT * FROM cdiary</parameter> </parameters> </soap.call> </set> <println> <m_response /> </println> <println> <sql.toHTML table-style='bgcolour: \#CCCCCC' th-bgcolour='azure' table-titles='cdiary'> <in><m_response/></in> </sql.toHTML> </println> </body> </xsql-script>