Where its used?

The field itype is available within the body of an Iteration. It is mostly used with the sql operation but the meta fields are also available when using the other operations.

How is it used?

When used within an Iteration with an operation of type sql the column values from SQL query are available. The name of each field is determined by the SQL column title, so it is important to ensure all the fields returned by the SQL query are unique.

Whilst in the body of an Iteration the following meta field values are available:

  • #Row - The current row number being itereated over (starting from 1)
  • #NumRows - The total number of results returned by the query
  • #NumFields - The total number of fields returned by the query (number of columns, applicable to SQL only)

Examples

Example 1: Meta Fields

This example demontrates the meta fields being used to display information about the iteration

<iteration type="repeat">
	<control>5</control>
	<body>
		<instruction>
			<input type="field" value="#Row" />
		</instruction>
		 of 
		 <instruction>
		 	<input type="field" value="#NumRows" />
		 </instruction>
		 |
	</body>
</iteration>
1 of 5|2 of 5|3 of 5|4 of 5|5 of 5| 

Example 2: SQL Fields and Meta Fields

The following example use this simple SQL table:
+----+-----------+
| id | name      |
+----+-----------+
|  1 | Salvatore |
|  2 | Jazz      |
|  3 | Claire    |
|  4 | Hailey    |
|  5 | Burt      |
+----+-----------+

This example outputs the names from the table in reverse order. For each ouput the row number is displayed using the meta fields:

<iteration type="sql">
	<control>select id, name from members order by id desc</control>
	<body>
		<instuction operation="append">
			<input>R=</input>
			<input type="field" value="#Row">
			<input>of</input>
			<input type="field" value="#NumRows">
			<input>, N=</input>
			<input type="field" value="name">
			<input>|</input>
		</instruction>
	</body>
</iteration>
R=1of5, N=Burt|R=2of5, N=Hailey|R=3of5, N=Claire|R=4of5, N=Jazz|R=5of5, N=Salvatore|

There are more examples of field usage in the documentation for the sql operation.




Last Modified: Thu, 15 Jan 2015