Sunday, January 20, 2013

InfoPath 2013: Using the Unsupported position() Function

When using XPath expressions in InfoPath you may find that position() and last() are not supported. They are not supported in the intended XPath expression usage where you apply the function to a data element to find the position or retrieve the last element. However, the position() function by itself may still be applied to a Calculated Value control to determine the current position of an element in a repeating data structure.

At first it doesn't appear that position() works when you attempt to add a Calculated Value control. Entering position() in the XPath box produces the unsupported message.


 
Function position() and last() are not supported.
 
 
However, if you simply select a field or function that is supported you may click OK to add the Calculated Value control to your form. Then you can edit the Calculated Value Properties:


And enter position() in the XPath:

 
 
Clicking OK this time allows the function to be used. This function comes in handy when used with repeating tables to produce a row number or incremental value to each data entry:

 
 
So position() is not supported but it is works by itself.

 

3 comments:

  1. How do you retrieve that value in code? I'm getting an error.

    ReplyDelete
  2. I use custom code for my Infopath form. Nevermind I figured it out. I actually removed position() and went a different way with it.

    ReplyDelete

Matched Content