This question about Documentation: Asked

can you provide examples for formating

hi!

I am using your great sqlPlugin, but I can't get behind the Syntax for Format, Header, footer...

For example, when retrieving a single row and column from a database, how to avoid the column title in the Output? I just want to use the Information given in the data field without the heading.

Maybe you can provide one or two short examples on how to use Format, Header, footer?

-- RalfWigand - 21 Jul 2014

The formatting syntax is the same as in other Foswiki macros. The only trick is to know that the row values are in $variables named after the table column names.

By trial and error I came up with this:

%SQL{database="myDatabase" query="SELECT field1,field2 FROM myTable WHERE myParameter like ?"  params="foo%" header="" format="| $field1 | $field2 |$n"}%

If you want to customize the header:

%SQL{database="myDatabase" query="SELECT field1,field2 FROM myTable WHERE myParameter like ?"  params="foo%" header="| Column 1 | Column 2 |$n" format="| $field1 | $field2 |$n"}%

-- RafaelVarela - 13 Jul 2017
 

QuestionForm edit

Subject Documentation
Extension SqlPlugin
Version Foswiki 1.1.9
Status Asked
Related Topics
Topic revision: r2 - 13 Jul 2017, RafaelVarela - This page was cached on 15 Jan 2018 - 06:15.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License