The Orders table that we have created in the Orders sub page is a dynamic table that generates one row for each Order element (or record) in the page source Orders.xml. The Order elements are presented in the order in which they occur in the data file. But we can control which Order elements are displayed. This is done with the Visible property of the Table Row Group. The property takes an XPath expression that selects the Order elements to display
To set the XPath expression of the Visible property, select the repeating row in the design, and, in the Styles & Properties Pane, go to the properties of the Table Row Group, and click the XPath icon of the Visible property. In the Edit XPath/XQuery Expression dialog that appears, enter the following XPath expression:
if ($XML1/Root/CustomerCode!='All') then CustomerCode=$XML1/Root/CustomerCode else CustomerCode
This XPath expression works as follows:
1.The if clause of the expression tests whether the element $XML1/Root/CustomerCode contains the string All.
2.If the element $XML1/Root/CustomerCode does not contain the string All, then all Order elements that have their CustomerCode element content equal to the content of the $XML1/Root/CustomerCode element will be selected. In effect, these will be the Order elements of the customer that was selected by the end user. Remember that the customer's CustomerCode has been stored in the $XML1 page source (see Top Page: Action Group, Go to Sub Page).
3.If the element $XML1/Root/CustomerCode contains the string All, then all Order elements that have a child CustomerCode element will be selected. In effect, this will select all Order elements in the data file.
|Note:||The advantage of using the Visible property is that it is a simple, efficient, and effective alternative to other ways of generating a table containing selected elements only.|