Reference Column Values in Weblet Properties

LANSA WAM

Reference Column Values in Weblet Properties

Referencing column values in a grid is a little different than you may have seen before.  When using a standard list you can reference the value of a column using an XSLT variable of the same name ($COLUMNNAME).  This is not possible with the grid so it is necessary to access a column with the following XPath expression:

../lxml:column[@name='COLUMNAME']

 

This is not necessary for referencing the current column (i.e. the column containing the weblet).  In this case you can use a single period (.).

If you know the position of the column you want to reference, you can use an Xpath expression like this:

../lxml:column[2]

 

This is handy for large lists as it is much faster but it may cause problems if you change the order of the columns in your list.

Note: All field and column name references in XPath expressions must be uppercase. All references to repository fields must use the object name for the field.

Also see

confirmText

The XPath expression tells the XSLT processor where to find the column in the XML data output by the Webroutine.  Like DOS or Linux file paths, the expression indicates a path to the target data from the current position and, like file paths, a period (.) refers to the current position and two periods (..) refer to the parent.
Following is the XML output for a single row in the list:

<lxml:entry>
   <lxml:column name=
"EMPNO" id="EMPLIST.0002.EMPNO">A0090</lxml:column>
   <lxml:column name=
"SURNAME" id="EMPLIST.0002.SURNAME">BLOGGS</lxml:column>
   <lxml:column name=
"GIVENAME" id="EMPLIST.0002.GIVENAME">FRED JOHN ALAN</lxml:column>
   <lxml:column name=
"DEPTMENT" id="EMPLIST.0002.DEPTMENT">FLT</lxml:column>
</lxml:entry>


When processing a weblet in a grid column, the current position in the XML is the <lxml:column> tag for that row and column.  An XPath expression like this:

   ../lxml:column[@name='EMPNO']

says to go up to the parent <lxml:entry> tag, look for a child <lxml:column> tag with a name attribute of 'EMPNO' and return it.