Error when querying sharepoint for displayname of editor column - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Error when querying sharepoint for displayname of editor column

Last post 03-06-2018 06:25 AM by prashant99. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 05-25-2010 08:22 AM

    Error when querying sharepoint for displayname of editor column

    I have successfully used the AD web service to populate my:Tasks/my:UserInfo/my:DisplayName  and display it on a form in a text field

    I have a button that then run the data connection "GetListItemsStr" to query a SP list.

    I used the query builder to create the xml

    When I use this query string it return all items:

    <query><columns><column name='ID'/><column name='Title'/><column name='Status'/><column name='DueDate'/><column name='CalendarItem'/><column name='Modified_x0020_Comment'/><column name='Status'/><column name='AssignedTo'/></columns><filter><ge><column name='Editor'/><value>""</value></ge></filter><sort><column name='DueDate' order='ASC'/></sort></query>

     When I use a this query generated by querybuilder to filter to the value of the editor field below, I get the error below:

    concat("<query><columns><column name='ID'/><column name='Title'/><column name='Status'/><column name='DueDate'/><column name='CalendarItem'/><column name='Modified_x0020_Comment'/><column name='Status'/><column name='AssignedTo'/></columns><filter><eq><column name='Editor'/><value>", xdXDocument:get-DOM()/my:Tasks/my:UserInfo/my:DisplayName ,"</value></eq></filter><sort><column name='DueDate' order='ASC'/></sort></query>")

    The query cannot be run for the following DataObject: GetListItemsStr
    InfoPath cannot run the specified query.
    The SOAP response indicates that an error occurred on the server:

    System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
       at System.Xml.XmlTextReaderImpl.Throw(Exception e)
       at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
       at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
       at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
       at System.Xml.XmlDocument.Load(XmlReader reader)
       at System.Xml.XmlDocument.LoadXml(String xml)
       at Qdabra.Dbxl.WebService.QuerySharePointService.XmlFromString(String str)
       at Qdabra.Dbxl.WebService.QuerySharePointService.GetListItemsStr(String listUrl, String query, String queryOptions)
       --- End of inner exception stack trace ---

    Any help would be apprecitated

     

     

  • 05-25-2010 08:40 AM In reply to

    Re: Error when querying sharepoint for displayname of editor column

    Hi Marzipan,

    I would encourage you to follow the existing documentation so that you may become familiar with the process. We have a User Guide and a step by step tutorial available here: http://www.infopathdev.com/files/folders/integration_with_sharepoint/default.aspx

    As for the error you encountered, it sounds like you are trying to use the dynamic query (concat) in the data connection wizard. However, it should be used in rules. The tutorial linked above explains how to set up your form for this.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 05-25-2010 11:53 AM In reply to

    Re: Error when querying sharepoint for displayname of editor column

    ok, i get that we cannot use the concat() in the data connection, I modified it so the query parameter so it is not using a <filter> argument.

     I don't follow on how to configure the button to to return a filtered row set; I am using the GetListItemsStr not the GetDropDownEntries so the step-by-step example is not acurate.

     

  • 05-25-2010 12:07 PM In reply to

    Re: Error when querying sharepoint for displayname of editor column

    Hi Marzipan,

    Whether you use GetDropDownEntries or GetListItemsStr, the same general steps will apply:

    1. Create the data connection using the first query string, but do not execute it on load.

    2. You need a rule that kicks off when the user enters a value or clicks a button (i.e. whenever the necessary info is entered into the form). This rule will have the following actions:

    2a) Set the value of <queryxml> to the concat() query.

    2b) Query the data connection

    If this doesn't work for you, please attach the xsn so that we may take a look at the data connections and rules. Thanks!

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 05-25-2010 01:02 PM In reply to

    Re: Error when querying sharepoint for displayname of editor column

    ok, I figued it out.

     2a) create an action to set a fields value for the "query" field under the "queryFields group, use the function icon and set the formula to the concat() string.  this replaces the value of this field before you run the second action run the data connection.

    concat("<query><columns><column name='ID'/><column name='Title'/><column name='Status'/><column name='DueDate'/><column name='CalendarItem'/><column name='Modified_x0020_Comment'/><column name='Status'/><column name='AssignedTo'/><column name='Editor'/></columns><filter><contains><column name='AssignedTo'/><value>", xdXDocument:get-DOM()/my:Tasks/my:UserInfo/my:UserName ,"</value></contains></filter><sort><column name='DueDate' order='ASC'/></sort></query>")

    Note: when I tried to use the parameter username() vs "xdXDocument:get-DOM()/my:Tasks/my:UserInfo/my:UserName" it would not work, I had to create a field in my main data source and have it default to the username()  parameter.

    Can you explain why you could not just use the username() parameter and yet the example uses the parameter current() ??  I assme the username() paramater is not in scope?

     

     

     

     

     

  • 05-25-2010 08:24 PM In reply to

    Re: Error when querying sharepoint for displayname of editor column

    To type the username function into a formula box, you need to type userName() (notice the capital N) when "Edit XPath" is not checked, or xdUser:get-UserName() (all case sensitive) if it is checked.  The Insert Function... button will take care of this for you.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 03-06-2018 05:16 AM In reply to

    • Jester
    • Not Ranked
    • Joined on 03-05-2018
    • Posts 1

    Re: Error when querying sharepoint for displayname of editor column

    Good morning, I am having trouble locating the document you mentioned above. I need to collect either the PreferredName or the DisplayName of my Current User and place it in a Comment Field. UserName is a CAC number.... I need their name.... Any assistance is appreciated. Thank  you! Anne

  • 03-06-2018 06:25 AM In reply to

    Re: Error when querying sharepoint for displayname of editor column

    check this link : https://www.qdoscc.com/blog/how-automatically-retrieve-current-username-infopath-sharepoint-list-form

    Prashant
Page 1 of 1 (8 items)
Copyright © 2003-2018 Qdabra Software. All rights reserved.
View our Terms of Use.