var - Var

Specifies the name of a variable to make row data available.

Category

data

Syntax

var="name"

Usage

In Design mode, click the top tab under Properties and look for Collection name, or click All Properties and look for var under data.

The named variable can be used in scripts to refer to members of the data source. For example, if the data source is a NotesDataCollection object, this variable refers to the NotesDocument objects therein.

Examples

This data table uses a variable to get items from the documents associated with the table rows.
<xp:dataTable id="dataTable1" rows="30"
	value="#{javascript:return database.getAllDocuments()}" var="rowdoc">
	<xp:column id="column1">
		<xp:this.facets>
			<xp:label value="subject" id="label1" xp:key="header" style="font-weight:bold"></xp:label>
		</xp:this.facets>
		<xp:text escape="true" id="computedField1"><xp:this.value>
			<![CDATA[#{javascript:return rowdoc.getItemValueString("subject")}]]>
		</xp:this.value>	</xp:text>
	</xp:column>
	<xp:column id="column2">
		<xp:this.facets>
			<xp:label value="fruit" id="label2" xp:key="header" style="font-weight:bold"></xp:label>
		</xp:this.facets>
		<xp:text escape="true" id="computedField2"><xp:this.value>
			<![CDATA[#{javascript:return rowdoc.getItemValueString("fruit")}]]>
		</xp:this.value></xp:text>
	</xp:column>
</xp:dataTable>