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.
And enter position() in the XPath:
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.
How do you retrieve that value in code? I'm getting an error.
ReplyDeleteIn code behind? Not sure what you mean.
DeleteI use custom code for my Infopath form. Nevermind I figured it out. I actually removed position() and went a different way with it.
ReplyDelete