Can Not Get Repeating Field Rules Correct

K

K.C. Yerrid

Hello All,

I am designing an InfoPath (SP1 enabled) that takes information from a
secondary data source (WSS). The control on my form is within a repeating
section, which is databound to a sequence 0... MaxOccurs=Unbound.

There are 4 primary fields in play: EmployeeID (value of control), First
Name, Last Name, and Full Name (Display Field, non-calculated from WSS).

When I change the value in the drop down control, I have a series of rules
that set the field properties of the underlying structure. For the 1st
instance of the drop down, this works beautifully. In order to do this, I
have the following XPath definition defined:

xdXDocument:GetDOM("Employee Lookup
Information")/dfs:myFields/dfs:dataFields/dfs:Employee_Lookup_Information/@First_Name[../@Employee_ID
=
xdXDocument:get-DOM()/EVG-GOV-PMO-SDLC-101F/SDLCAuditTrail/headerInfo/documentOwners/SDLCChangeOwner/ID]

Basically, grab the value in the control, and do a lookup against WSS where
the value in the control equals the value in the WSS list. Finally, set the
property in the XML document.

The problem is when I insert an additional section, and change the value in
the control, it does not refresh the value to query against, and I end up
with a duplicate name.

In order to try to see exactly what is going on, I saved the raw XML
document, and looked at the values of the ID fields for the document, and
they appear correct; however, the name is carried over from the previous
(first) instance of the ID.

Does anyone know what I may be overlooking here? I know it is probably
difficult to envision without the schema or XML doc in front of you.

Thank you for your response in advance!

-K.C.
 
K

KjellSJ

You will always get the first element of an XPath node set unless you specify
an index into the node set. You should look at using the preceding-sibling
axis in your XPath query to get the value from the immediate node before the
current node:
http://kjellsj.blogspot.com/2005/04/using-xpath-preceding-sibling-in.html


KjellSJ
http://kjellsj.blogspot.com

K.C. Yerrid said:
It seems that there is a function within the XPath model called current()
that may hold a clue, but unfortunately, no combination that I have tried
seems to work.

I checked the blog at
http://blogs.msdn.com/infopath/archive/2004/09/13/228881.aspx for some
additional information, but still am stuck.

Any help would be greatly appreciated!

Thanks!

-K.C.

K.C. Yerrid said:
Hello All,

I am designing an InfoPath (SP1 enabled) that takes information from a
secondary data source (WSS). The control on my form is within a repeating
section, which is databound to a sequence 0... MaxOccurs=Unbound.

There are 4 primary fields in play: EmployeeID (value of control), First
Name, Last Name, and Full Name (Display Field, non-calculated from WSS).

When I change the value in the drop down control, I have a series of rules
that set the field properties of the underlying structure. For the 1st
instance of the drop down, this works beautifully. In order to do this, I
have the following XPath definition defined:

xdXDocument:GetDOM("Employee Lookup
Information")/dfs:myFields/dfs:dataFields/dfs:Employee_Lookup_Information/@First_Name[../@Employee_ID
=
xdXDocument:get-DOM()/EVG-GOV-PMO-SDLC-101F/SDLCAuditTrail/headerInfo/documentOwners/SDLCChangeOwner/ID]

Basically, grab the value in the control, and do a lookup against WSS where
the value in the control equals the value in the WSS list. Finally, set the
property in the XML document.

The problem is when I insert an additional section, and change the value in
the control, it does not refresh the value to query against, and I end up
with a duplicate name.

In order to try to see exactly what is going on, I saved the raw XML
document, and looked at the values of the ID fields for the document, and
they appear correct; however, the name is carried over from the previous
(first) instance of the ID.

Does anyone know what I may be overlooking here? I know it is probably
difficult to envision without the schema or XML doc in front of you.

Thank you for your response in advance!

-K.C.
 

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