I have an Infopath form, I want to get the lists of records in a form library but I want to exclude the current Item, if I'm editing the item x I want the number of items without this item.

I want to use a rule in the form load to stablish the field of the query that retrieve the lists . (in this case I want to exclude this id)


I actually thought this would be easy when I read the question -- but doing a not equals is much more difficult in InfoPath!

The best way I can figure out how to get it to work assumes that you're working on 2010 or later -- because you can just use a web service...

I'll show an example using a REST Web Service: You want to create a new data source by going to the 'Data' tab then choosing 'From Web Service' then 'From REST Web Service' Set the URL for the service to get the items from the list your interested in, it should look something like:

http[s]://<site>/<sitecollection>/[<subsite>/]_api/lists/getByTitle('<ListTitle')/items?$Filter=Id ne 1

Notice the part after ?$Filter= is 'Id ne 1' -- this is the REST API way of saying get all the items whose Id field is not equal to 1 (it is Id for the REST API, not ID or id). It doesn't matter if your list has an item with Id=1 or not, we're just setting up the URL so InfoPath understands the data that will come back from the web service.

In the next step, uncheck retrieve data on form load.

Now you can go to the form load rules and create a new rule, notice that one of the options under the 'Run these Actions' dropdown is now 'Change REST URL" -- change the URL to something like

getByTitle('<ListTitle')/items?$Filter=Id ne", CurrentItemID)

Then query for data -- and you should have all of the items that aren't the same ID as the current item.

NOTE: If you're using 2010 there is no _api and you need to use:


  • thanks, I solved it with a conditional logic but is better to know your way. – Luis Molina Jul 27 '14 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.