InfoPath Data Connection Lookup in Repeating Section

  • Thread starter Tyler Allbritton
  • Start date
T

Tyler Allbritton

I am trying to pull some information from a SharePoint list into a repeating
section on my InfoPath form. For simplicity let's say my repeating section
has two attributes: key and value. When a user enters a key, a rule fires and
looks up the value from the second data connection.

For the first entry in the repeating section, this works great. However, if
the user adds another entry to repeating section and enters a different key,
it will always return the value based on the first key.

Am I doing something wrong, or can Infopath not perform lookups with
repeating elements?

Thanks,
Tyler Allbritton
 
P

Peter Huang [MSFT]

Hi Tyler,

Thanks for your feedback.
Based on my test, I can reproduce the problem.
So far I am researching the issue and I will reply to you ASAP.



Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang [MSFT]

Hi Tyler,

I think you may take a look at the KB below.

RESOLUTION
If the control is in the context of the repeating container, replace the
part of XPath for the filter that matches the binding of the repeating
container with the current() property. For example, to use the current()
property, replace the part of XPath in the "Steps to reproduce the problem"
section. To do this, follow these steps:1. Start Microsoft Office InfoPath
2003 Service Pack 1.
2. Open your template.
3. Right-click the second list box, and then click List Box Properties.
4. In the List Box Properties dialog box, click Select XPath under Entries.
5. Click Filter Data, and then click Modify.
6. In the Specify Filter Conditions dialog box, click Use a formula in the
third list box.
7. In the Insert Formula dialog box, click to select the Edit XPath
(advanced) check box.
8. In the Formula box, type the following:
current()/yourfield
The filter may filter data in the first item of the repeating section or in
the first item of the repeating table instead of in the current item in
InfoPath 2003 Service Pack 1
http://support.microsoft.com/kb/870843

NOTE: because the in the KB, the listbox bounding to the company, not
companyname, so we use current()/my:field1, if we just bound to the sub
node directly, you may try current() directly.


Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

Tyler Allbritton

Ok - the goal is to lookup a title attribute from "ICM" based on an icmnumber
attribute entered on the current form. Following the KB entry, I changed the
following original xpath:

xdXDocument:GetDOM("ICM")/dfs:myFields/dfs:dataFields/dfs:ICM/@Title[../@Issue_Number = xdXDocument:get-DOM()/my:myFields/my:icm/my:icmNumber]

to:

xdXDocument:GetDOM("ICM")/dfs:myFields/dfs:dataFields/dfs:ICM/@Title[../@Issue_Number = current()/my:icmNumber]

According to Infopath, the xpath is valid, but it now returns no data,
instead of the data associated with the wrong repeating item. Any ideas what
is wrong?

Thanks,
Tyler
 
P

Peter Huang [MSFT]

Hi Tyler,

Thanks for your quickly reply!
This seems to be the problem I encounter when I try to reproduce the KB
behavior.
I think you may try the following. Because from the KB, the Listbox is
binding to the company element which is the "parent" of companyName/product.
xdXDocument:GetDOM("ICM")/dfs:myFields/dfs:dataFields/dfs:ICM/@Title[../@Iss
ue_Number = current()]

You may have a try and let me know the result.
If you have any other concern, please feel free to let me know.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

Tyler Allbritton

Peter,
Thanks! That worked. Though I must admit I do not understand how. Does
infopath relate the two by type? Since I replaced the form reference
(icmnumber) with current(), how does it know which field I want to compare
the remote issue_number to? Anyway, thanks again.

-Tyler Allbritton
 
P

Peter Huang [MSFT]

Hi Tyler,

Based on knowledge, in the KB demo, the listbox binds to company, so we
provided the company A as current(), so the current()/my:field1 means the
sub element of company.

But in our test, the current() has already pointed to the most sub node, so
if we use current()/..., it will get nothing, we need to use current().
Because in our scenario, we binding the Key element to the sharepoint list,
but the Value element is set by an action, so the current() should point to
the key, it will not point to other element in the list.

I found this by testing with an addiional action "Show dialog box
expression:" to show the current().

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang [MSFT]

Hi Tyler,

Just want to say Hi, and I was wondering how everything is going.
If anything is unclear, please let me know.
It is my pleasure to be of assistance.


Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top