D
DavidR
Hi,
I have simulated a multi select list box in infopath by adding a repeating
table with a drop down list to a scrollable region. One of the things I need
to do is ensure the user doesn't select the same item from the drop down more
than once.
So I've created a validation routine in the OnValidate event in the c# Form
Code page. The routine performs an XPath query on the value just selected,
and if there is more than one node returned, an error should be reported.
The xml I'm querying on is something like follows:-
<SignOffDetails>
<AdvisorsCirculated>
<Advisor>1</Advisor>
<Advisor>2</Advisor>
<Advisor>1</Advisor>
...
</AdvisorCirculated>
</SignOffDetails>
So in the above, if I do a query on the value 1, it should return 2 nodes.
If I do a query on the value 2 it should return 1 node.
The XPath query I'm using on the above xml is :-
AdvisorsCirculated[Advisor=value]/Advisor
The query is returning a list of all Advisor nodes under AdvisorsCirculated
rather than those with the value I want. I believe this is because the query
is saying to return all Advisor nodes where the AdvisorsCirculated node has
any Advisor child = value.
I've also tried Advisor[Advisor=value] from a starting point of the
AdvisorsCirculated node. This always returns 0 nodes. I believe this is
because it is testing for children of the advisor node, of which there are
none.
Can anyone confirm my above assertions, and possibly suggest an XPath query
to return the correct number of nodes.
Any help with this problem would be much appreciated.
Thanks,
David.
I have simulated a multi select list box in infopath by adding a repeating
table with a drop down list to a scrollable region. One of the things I need
to do is ensure the user doesn't select the same item from the drop down more
than once.
So I've created a validation routine in the OnValidate event in the c# Form
Code page. The routine performs an XPath query on the value just selected,
and if there is more than one node returned, an error should be reported.
The xml I'm querying on is something like follows:-
<SignOffDetails>
<AdvisorsCirculated>
<Advisor>1</Advisor>
<Advisor>2</Advisor>
<Advisor>1</Advisor>
...
</AdvisorCirculated>
</SignOffDetails>
So in the above, if I do a query on the value 1, it should return 2 nodes.
If I do a query on the value 2 it should return 1 node.
The XPath query I'm using on the above xml is :-
AdvisorsCirculated[Advisor=value]/Advisor
The query is returning a list of all Advisor nodes under AdvisorsCirculated
rather than those with the value I want. I believe this is because the query
is saying to return all Advisor nodes where the AdvisorsCirculated node has
any Advisor child = value.
I've also tried Advisor[Advisor=value] from a starting point of the
AdvisorsCirculated node. This always returns 0 nodes. I believe this is
because it is testing for children of the advisor node, of which there are
none.
Can anyone confirm my above assertions, and possibly suggest an XPath query
to return the correct number of nodes.
Any help with this problem would be much appreciated.
Thanks,
David.