none
Bind Dropdown List to a ListData.svc result

    Question

  • Hi,

    On my InfoPath 2010 form, I have a dropdown. Here is what I am trying to achieve.

    • I have 2 lists. "OrderMaster" and "Customers". Former is related to the later through a lookup column " Customer"
    • I have created a REST data connection with $expand option http://xxx:12345/dp/_vti_bin/listdata.svc/OrderMaster()?$expand=Customer
    • From InfoPath, while right clicking the dropdown, I am able to see the following in the "Entries". My requirement is to bind the dropdown to "Customer Code".  In fact I want to know how I can bind to anything that comes under "m:properties"
      infopath data connection

    Please guide me to solve the issue.

    Below is the XML I am getting with the url http://xxx:12345/dp/_vti_bin/listdata.svc/OrderMaster()?$expand=Customer

      

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <feed xml:base="http://trvmosadvw004:12345/dp/_vti_bin/listdata.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
      <title type="text">OrderMaster</title>
      <id>http://trvmosadvw004:12345/dp/_vti_bin/listdata.svc/OrderMaster/</id>
      <updated>2012-04-16T13:15:25Z</updated>
      <link rel="self" title="OrderMaster" href="OrderMaster" />
      <entry m:etag="W/&quot;1&quot;">
        <id>http://trvmosadvw004:12345/dp/_vti_bin/listdata.svc/OrderMaster(1)</id>
        <title type="text">011245</title>
        <updated>2012-04-16T18:25:04+05:30</updated>
        <author>
          <name />
        </author>
        <link rel="edit" title="OrderMasterItem" href="OrderMaster(1)" />
        <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Customer" type="application/atom+xml;type=entry" title="Customer" href="OrderMaster(1)/Customer" />
        <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CreatedBy" type="application/atom+xml;type=entry" title="CreatedBy" href="OrderMaster(1)/CreatedBy" />
        <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" type="application/atom+xml;type=entry" title="ModifiedBy" href="OrderMaster(1)/ModifiedBy" />
        <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Attachments" type="application/atom+xml;type=feed" title="Attachments" href="OrderMaster(1)/Attachments" />
        <category term="Microsoft.SharePoint.DataService.OrderMasterItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
        <content type="application/xml">
          <m:properties>
            <d:ContentTypeID>0x01003C63FE689A413E439A752250F3F4B117</d:ContentTypeID>
            <d:Title>011245</d:Title>
            <d:CustomerId m:type="Edm.Int32">1</d:CustomerId>
            <d:OrderDate m:type="Edm.DateTime">2012-04-16T00:00:00</d:OrderDate>
            <d:Id m:type="Edm.Int32">1</d:Id>
            <d:ContentType>Item</d:ContentType>
            <d:Modified m:type="Edm.DateTime">2012-04-16T18:25:04</d:Modified>
            <d:Created m:type="Edm.DateTime">2012-04-16T18:25:04</d:Created>
            <d:CreatedById m:type="Edm.Int32">1073741823</d:CreatedById>
            <d:ModifiedById m:type="Edm.Int32">1073741823</d:ModifiedById>
            <d:Owshiddenversion m:type="Edm.Int32">1</d:Owshiddenversion>
            <d:Version>1.0</d:Version>
            <d:Path>/dp/Lists/OrderMaster</d:Path>
          </m:properties>
        </content>
      </entry>
     </feed>

    Thanks in advance


    Arun D Gangadharan




    Monday, April 16, 2012 1:58 PM

Answers

  • Hi Entan,

    Thanks for the reply. I have found the mistake I was making. In fact If you look at the atom xml, related entity is there inside "m:inline" node. I did binding as below and it started working as expected.


    Arun D Gangadharan

    Wednesday, April 18, 2012 9:26 AM

All replies

  • Hi ,

    I understand that you create a REST web service data connection to retrieve data from a the Order Master list and you want to bind the customer code  to the dropdown list control .

    The controls under the m:properties are all the columns for each items in the list .In your situation , the Customer Code is a column in the Order Master list .If so ,you can edit the property for the dropdown list control .In the Entries choose the Customer Code .Then the value and display for the drop down list control are automatically set  .It is the same to bind the drop down list control to other columns returned from the web service ,just change the entries to the column when edit  the Drop-Down List Box Properties .

    Thanks

    Entan Ming

    TechNet Community Support

    Wednesday, April 18, 2012 3:04 AM
  • Hi Entan,

    Thanks for the reply. Actually I am not trying with the REST service I created. I want to use the OOB REST service Listdata.svc which returns the data as an atom feed i believe. I am able to bind my dropdown to the feed data to a column on "OrderMaster" list (under node "m:properties") just like you mentioned. But what I really want (not sure its the right approach or not) is to bind the control to field that is present on the related list, not on the master list (my case i have CustomerCode defined on Customers List). Ordermaster is "related" to Customers list through a lookup column "Customer". To get the related list item record included in the returned xml, I am using "$expand" parameter.

    http://scottcurrier.wordpress.com/2010/01/02/rest-and-sharepoint-2010-quick-start-guide-multiple-columns-expand-and-filter-almost-a-join/


    Arun D Gangadharan


    Wednesday, April 18, 2012 5:30 AM
  • Hi ,

    I noticed that in the article you provide ,they add the columns in the parent list as additional columns to the child list .When you add the lookup column Customer ,have you check the Customer Code as additional column ?If not ,then you need to edit the OrderMaster list .Edit the Customer column .Check Customer code column in the Additional Column Settings .

    Then you can get the Customer Code column in the xml file .Then bind the column to drop down list like other column .If you still cannot bind the column to the dropdown list control ,then you should add another rest web service data connection to get value form Customer list .

    Thanks

    Entan Ming

    TechNet Community Support

    Wednesday, April 18, 2012 8:17 AM
  • Hi Entan,

    Thanks for the reply. I have found the mistake I was making. In fact If you look at the atom xml, related entity is there inside "m:inline" node. I did binding as below and it started working as expected.


    Arun D Gangadharan

    Wednesday, April 18, 2012 9:26 AM