Skip to main content
Windward

Array Referencing

Overview

This article provides more advanced information about array referencing, or how to reference individual data items in the for data set that you select. 

 

 

The notation for referencing a data item in a data set (array of values) is a square bracket with a number.  For example, you have the following data set below returned for a list of employees from your ForEach tag.  If you wanted to print out "Michael Suyama" you would need to reference value number 5 in the data set like this [5].  

 

Data Set

 

Row Number First Name Last Name
0

Nancy

Davolio

1

Andrew

Fuller

2

Janet

Leverling

3

Margaret

Peacock

4 Steven

Buchanan

5 Michael Suyama
6 Robert King
7 Laura Callahan
8 Anna Dodsworth

 

Using an Out Tag, you can accomplish this by placing the square bracket value after the ForEach data set variable and before the period and returned column name.

<wr:forEach select='SELECT Employees.FirstName, Employees.LastName FROM Employees' var='Employees' datasoure='MSSQL'>

 

<wr:out select='${Employees[5].FirstName}'> <wr:out select='${Employees[5].LastName}'>

 

<wr:endforeach>

 

OUTPUT:  

5 Michael Suyama