Reading data from XML Datasource - InfoPath Dev
in

InfoPath Dev

Reading data from XML Datasource

Last post 11-30-2011 11:25 AM by dsk96m. 28 replies.
Page 2 of 2 (29 items) < Previous 1 2
Sort Posts: Previous Next
  • 11-23-2011 10:09 AM In reply to

    Re: Reading data from XML Datasource

    Did you see my xml file?  Can you help make cascading list boxes based off of that xml.  Do I need to change the format of the xml?

  • 11-23-2011 10:16 AM In reply to

    Re: Reading data from XML Datasource

    would it work better if the xml was like

    <Roster>
     <manager id="1">OAKLEY, VINCENT</manager>
      <manager2 manager="1" id="1">BRUNER, ERICH</manager2>
       <manager3 manager2="1" id="1">Name</manager3>
       <manager3 manager2="1" id="2">Name</manager3>
        <manager4 manager3="2" id="1">Name</manager4>
        <manager4 manager3="2" id="2">Name</manager4>
        <manager4 manager3="2" id="3">Name</manager4>
        <manager4 manager3="2" id="4">Name</manager4>
        <manager4 manager3="2" id="5">Name</manager4>
        <manager4 manager3="2" id="6">Name</manager4>
        <manager4 manager3="2" id="7">Name</manager4>
        <manager4 manager3="2" id="8">Name</manager4>
        <manager4 manager3="2" id="9">Name</manager4>
        <manager4 manager3="2" id="10">Name</manager4>
        <manager4 manager3="2" id="11">Name</manager4>
       <manager3 manager2="1" id="3">Name</manager3>
       <manager3 manager2="1" id="4">Name</manager3>
       <manager3 manager2="1" id="5">Name</manager3>

    </roster>

  • 11-29-2011 05:11 AM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    Re: Reading data from XML Datasource

    I'll have a stab at it. I'm not even sure you need to use code. I'll use your first set of data. Though normally I would expect to see this kind of hierarchical data presented in a different way. I assume you get this XML from another source and this is the format it comes in?

    The way I usually  see it something like this:

    <staffMember id=X manager=Y>Name</staffMember>

    e.g.

    <staffMember id=1 manager=0>Name1</staffMember>
    <staffMember id=2 manager=1>Name2</staffMember>
    <staffMember id=3 manager=1>Name3</staffMember>
    <staffMember id=4 manager=2>Name4</staffMember>
    <staffMember id=5 manager=3>Name5</staffMember>

     

  • 11-29-2011 05:43 AM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    Hmm well, the datasource was all id's and people with the same name ;-) so it's hard to tell if this is working perfectly.

    But it looks correct. Attached.

    I had to add a dummy '1st level' person as the list box control wouldn't let me use the datasource with only one.

    Also note I've let the template have the secondary datasource xml file included in the template so you can use it right out, but included the file separately as well for your reference.

     

  • 11-29-2011 05:45 AM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    Re: Reading data from XML Datasource

     hmm only 1 attachment per post allowed. Here's the datasource.

  • 11-29-2011 09:22 AM In reply to

    Re: Reading data from XML Datasource

    awesome, i will take a look. 

     

    The xml i can arrange it anyway you want.  The data comes out of a db, sort of hard to get levels from it, but i was able to get the xml like what i showed you, i can change it around if that is easier

  • 11-29-2011 09:24 AM In reply to

    Re: Reading data from XML Datasource

    yea, i took the names out for privacy reasons.  they would be all different names

  • 11-29-2011 10:12 AM In reply to

    Re: Reading data from XML Datasource

    I would just need to redo my schema.

     

    Got to figure that one out.

  • 11-29-2011 10:30 AM In reply to

    Re: Reading data from XML Datasource

    What would the schema look like for your suggest hierarchy

    <?xml version='1.0' encoding='UTF-16'?>
    <!-- Created from XmlMap.Name: data_Map -->
    <!-- XmlMap.DataBinding.SourceUrl: C:\Documents and Settings\kiellda\Desktop\new  4.xml -->
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <xsd:element nillable="true" name="data">
      <xsd:complexType>
       <xsd:sequence minOccurs="0">
        <xsd:element minOccurs="0" maxOccurs="unbounded" nillable="true" name="staffMember" form="unqualified">
         <xsd:complexType>
          <xsd:simpleContent>
           <xsd:extension base="xsd:string">
            <xsd:attribute name="id" form="unqualified" type="xsd:integer"/>
            <xsd:attribute name="manager" form="unqualified" type="xsd:integer"/>
           </xsd:extension>
          </xsd:simpleContent>
         </xsd:complexType>
        </xsd:element>
       </xsd:sequence>
      </xsd:complexType>
     </xsd:element>
    </xsd:schema>

  • 11-29-2011 10:59 AM In reply to

    Re: Reading data from XML Datasource

    Now I know why it worked for you.  You are using filters.  Cant use filters in browser enabled forms.

  • 11-29-2011 03:55 PM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    Re: Reading data from XML Datasource

    mm - I didn't know that sorry.

    if conditional formatting works then you might be able to use repeating sections/table instead.

  • 11-29-2011 05:21 PM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

     Here's an example made with 'browser compatibility' setting on and using conditional formatting.

  • 11-30-2011 10:57 AM In reply to

    Re: Reading data from XML Datasource

    What does the xml look like for that?

  • 11-30-2011 11:25 AM In reply to

    Re: Reading data from XML Datasource

    This is how my data comes:

     Manager                            Employee

    Adams                                 word

    Adams                                 straw

    Adams                                snyder

    anderson                            arther

    anderson                            thomas

     

    and so on.  What i can do is export that into excel, manipulate it so that it is in the correct format, add the schema file, then export the xml for use by the form.  I just need to know how the data needs to be arranged and what the schema should be so that i can get it in the form that you mentioned above.

     

Page 2 of 2 (29 items) < Previous 1 2
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.