0

I have an InfoPath 2007 form that uses selectNodes to chose a collection of items from my web service. So I have

<customer>
  <City>
  <State>
</customer>

In my code I have something like

customerData.selectNodes("tns:customer");

Of course this gives me all customers. But what if I want to filter out customers that live in a particular state? How can I modify my approach if I wanted to exclude all values of "FL" in the state?

Unknown Coder
  • 6,625
  • 20
  • 79
  • 129

1 Answers1

1

Something like:

 customerData.selectNodes("tns:customer[not(State = 'FL')]");

Note that if "FL" comes from some other string you may need to perform escaping ( Special Character in XPATH Query ).

I'd recommend reading on XPath, i.e. here are some samples to get you started.

Community
  • 1
  • 1
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
  • Thanks for the answer - this put me on the right track. But, to be clear, the actual answer ended up being: customerData.selectNodes("tns:customer[(tns:State != 'FL')]"); I'm not sure exactly why it differs in that way, but after modifying it for a bit, thats the answer that I needed. – Unknown Coder Oct 04 '12 at 19:23