REST query works in IE, but fails in Infopath - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

REST query works in IE, but fails in Infopath

Last post 11-14-2013 10:12 AM by Hilary Stoupa. 15 replies.
Page 1 of 2 (16 items) 1 2 Next >
Sort Posts: Previous Next
  • 11-14-2013 05:57 AM

    REST query works in IE, but fails in Infopath

    Looking around the web I stumbled on this forum and you guys seem to know your stuff as well as being active in your forums, so I thought I'd join and ask this probably simple question, so first of all Hi!

    I'm very new to Infopath and Sharepoint and I've been tasked with creating a form for getting data from users out in the field. I've setup a REST query to return specific results which works fine in IE, but fails in Infopath saying "Sorry, we couldn't open https://etc..."

     

    When I ask for more details it gives me the following error...

     

    The query cannot be run for the following DataObject: RESTProInfoAll
    InfoPath cannot run the specified query.
    The file is not a valid XML file.
    Not enough storage is available to process this command.

    Or instead of Not enough storage I get an Access Denied error.

    The query is...

    https://Site/_vti_bin/listdata.svc/LstProInfoCur()?$select=Div,Name,Addr,City,St,Zip,Phone,FT&$filter=Div eq dlDiv - Where dlDiv is a field on the Infopath form

    I can run the above query in IE substituting the dlDiv with an actual value like 600 and I get filtered results. I can also run the query in Infopath without the filter on the end, but it returns too much data and takes too long. My guess is that this has something to do with getting the value of the dlDiv field, and instead the query is running as though it's searching for dlDiv in the Div column, which it will never find. If it's because I need to specify the value of the field, how do I specify that in the REST URL?

  • 11-14-2013 06:36 AM In reply to

    Re: REST query works in IE, but fails in Infopath

     Hey there - so when you set the REST URL in your form, are you using a concat formula to include the value of dlDiv?

    Hilary Stoupa

  • 11-14-2013 07:03 AM In reply to

    Re: REST query works in IE, but fails in Infopath

     Hi! No I'm not. I think I missed that part of the non-existant instruction class I got offered by the company! ;)

    I've seen some blogs and posts about doing this, but I have found it very confusing to follow what the concat does, and how it should be constructed to get what I want. I kinda need it in dummy terms and everything I've read seems to assume a pre-existing familiarity with the concat function, which I don't have.

    How can I format my query using concat to filter what I need?

  • 11-14-2013 07:13 AM In reply to

    Re: REST query works in IE, but fails in Infopath

    So, you need to add a rule that sets your URL. Have you done that? If not, you need to decide what change in your form should cause this query to happen. You'll add a rule with the action set a REST URL - and in that rule's dialog, click the fx button for the value.

    Your formula will look something like this: 

    concat("https://Site/_vti_bin/listdata.svc/LstProInfoCur()?$select=Div,Name,Addr,City,St,Zip,Phone,FT&$filter=Div eq", dlDiv)

    You'll pick the dlDiv field using the button that says "Insert field or group".

    If you need some help with this, you can attach your form (or a sample that has your REST connection in it) under the options tab and I'm happy to give you a hand.

    Hilary Stoupa

  • 11-14-2013 07:16 AM In reply to

    Re: REST query works in IE, but fails in Infopath

     Thank you!

    Gonna give it a whirl now and I'll let you know!

  • 11-14-2013 08:03 AM In reply to

    Re: REST query works in IE, but fails in Infopath

     Ok, I think that will work, except, the FT's are all numbers, 29, 36, 620, 300, etc. When I run the query on IE I get an error that "Operator 'eq' incompatible with operand types 'System.String' and 'System.Int32' at position", however both the dropdown list and the Sharepoint List have those fields set for string, so apparently something is converting the FT to an Integer and IE has an issue with that. How do I force the FT say 35 to get passed as a string, or for the sharepoint list to read the value in it as a string, whichever one is insisting on auto changing the value to an Int?

     I tried setting the filter up and setting the dlFieldRep as ...

    concat("https://site/_vti_bin/listdata.svc/LstFieldRepInfo()?$select=FT,RepSuperName&$filter=FT eq ", string(.)) - This is for a different list, but the values are the same as the initial list. If I enter in IE...

    https://site/_vti_bin/listdata.svc/LstFieldRepInfo()?$select=FT,RepSuperName&$filter=FT eq '35' - IE complies with returning a single value, however when I see the query run in infopath the 35 is not in single quote, leading me to believe it's not actually converting the value to string. Right?

  • 11-14-2013 08:20 AM In reply to

    Re: REST query works in IE, but fails in Infopath

    InfoPath is not going to add quotes for you. You will have to add them.

    concat("https://site/_vti_bin/listdata.svc/LstFieldRepInfo()?$select=FT,RepSuperName&$filter=FT eq '", string(.), "'")

    Hilary Stoupa

  • 11-14-2013 08:37 AM In reply to

    Re: REST query works in IE, but fails in Infopath

    Ok, related, but not while I'm waiting for the query to run it was taking forever!

    What's the difference between &$filter=FT eq '62' and  &$filter=FT equals '62'?

    And what's the fastest way to query data from a list, with a connection file loaded in a sharepoint connection library, or with a REST query? And do either of those have restrictions if the form is intended to be filled out using a browser?

     And THANK YOU for the help that worked, I feel pretty dumb not including the quotes.  :S

  • 11-14-2013 08:45 AM In reply to

    Re: REST query works in IE, but fails in Infopath

     Don't feel dumb - learning new things is a process.

    Does equals work in your query string? I don't see it in the URI Conventions: http://www.odata.org/documentation/odata-v2-documentation/uri-conventions/#45_Filter_System_Query_Option_filter

    If you have simple equivalence conditions, I'd probably use a SharePoint List data connection and the query fields - just for the sake of simplicity. But if you have more complex conditions than simple equivalence, REST is your only option.

    Both should work in the browser - but your mileage may vary with REST if you are using Office365. I can't remember if we can use REST from IP in O365. If your server is on-prem, you should be fine.

    Hilary Stoupa

  • 11-14-2013 09:03 AM In reply to

    Re: REST query works in IE, but fails in Infopath

    If I need to return say 60 - 100 results from a list of 2000, Rest is better than using a Sharepoint List data connection right? Or in particular I have a list of 12000 entries, I'm not able to limit the list to less than 2000 requests by using the list query am I?

    We are on O365, using the Infopath Preview I can get to the document, but I haven't been able to get a document able to be published yet to try it in a browser, so I guess we'll see.

  • 11-14-2013 09:23 AM In reply to

    Re: REST query works in IE, but fails in Infopath

     If you are using SharePoint 2010 and IP 2010, which you must be to be using REST, you do not have to return all the list items on load. Set up your list connection, and when you walk through the data connection, don't query on load. Then, in the form, you can set some query fields in the SharePoint list data source and execute the query to just return your results that match those query specifications. You won't be able to limit the number of items returned however - like I said, SharePoint List connections are good for simple equivalency. You can find some info here: http://blogs.msdn.com/b/infopath/archive/2010/05/06/sharepoint-list-data-connections-in-infopath-2010.aspx

    Hilary Stoupa

  • 11-14-2013 09:24 AM In reply to

    Re: REST query works in IE, but fails in Infopath

    So I'm trying to publish my form to a document library as a template 1. Is that the correct thing to do if I want it to be able to be filled out in a browser? 2. When publishing I get an error that says it was published, but can only be filled out using InfopathFiller as it contains features not usable in a browser, and to check the Design Checker.

    But when I check the design checker all I see is an error that says "Could not verify the form template on the server."

    So I can't fill it out in a browser because I can't publish it, but I can't publish it because it can't verify it's on the server...

    Seems like a circular argument to me....

     

  • 11-14-2013 09:35 AM In reply to

    Re: REST query works in IE, but fails in Infopath

     Your screenshots do not display. Try attaching under the Options tab in a reply.

    Hilary Stoupa

  • 11-14-2013 09:50 AM In reply to

    Re: REST query works in IE, but fails in Infopath

     First this error


  • 11-14-2013 10:05 AM In reply to

    Re: REST query works in IE, but fails in Infopath

     Then this one, can't figure out how to get more than one image in a post


Page 1 of 2 (16 items) 1 2 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.