InfoPath Q&A: How do I grab the value of another field in the same row of a repeating table?

by S.Y.M. Wong-A-Ton

Learn how to use the current() function in InfoPath to be able to retrieve a value from another column but in the same row of a repeating table.

Liz wrote:

I’m having trouble figuring out how to grab the value of the 1st field in a repeating table.
My table looks like this:

Polo color Polo Type Polo Size Polo Price

I have a repeating table so the user can pick multiple polos. I want to be able to pull the polo color on each row to manipulate the data for the following columns. Right now I keep pulling the value in the 1st row, 1st field. It will not pick up the value of the new row, 1st field. Any ideas?

Hi Liz,

There is a function in InfoPath 2003 and InfoPath 2007 called current(), which you can use to reference the currently active row and then retrieve values within that row. I don’t know how you’ve set up your form template, so I’m going to give you some general instructions on how you can test and see how the current() function works. Try the following:

  1. Add a repeating table to your form template. One with 3 columns will do just fine.
  2. Double-click the field in the third column and then click on the formula button behind the Default Value field.
  3. On the Insert Formula dialog box, type
    current()/../my:field1
  4. Click OK on all open dialog boxes.

Test the form by typing in something in the field in the first column. The value you typed in should appear in the third field in the same row once you leave the first field. Add another row and do the same. See how the current() function works?

You can also do this programmatically in InfoPath 2003. I once wrote the following article about this: Programmatically retrieve the value of another field in the same row of a repeating table.

Good luck with implementing current() in your own solutions!

 Subscribe (RSS | Email)

Related Posts

Comments to this post were closed 30 days after it was published.

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of S.Y.M. Wong-A-Ton. Usage of techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author, S.Y.M. Wong-A-Ton.

Working with InfoPath