IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

XML Not populating properly Options · View
Kiamarz
Posted: Friday, February 20, 2015 2:34:46 AM
Rank: Member

Joined: 10/2/2012
Posts: 27
Location: Motor City
My mapping project is generating an XML file from a flat csv. The output is being generated in the sequence:

Code:

<Agency>
   <AgencyName>Development Center</AgencyName>
   <aC_ProgramID>879</aC_ProgramID>
      <Site>
         <SiteName>Gompers-B25</SiteName>
            <Class>
               <ClassName>HS-103</ClassName>
                  <DaysOpen>
                     <Month>11</Month>
                     <DateOpen>2014-11-25</DateOpen>
                  </DaysOpen>
            </Class>
      </Site>
</Agency>
<Agency>
   <AgencyName>Development Center</AgencyName>
   <aC_ProgramID>879</aC_ProgramID>
      <Site>
         <SiteName>Gompers-B25</SiteName>
            <Class>
               <ClassName>HS-103</ClassName>
                  <DaysOpen>
                     <Month>11</Month>
                     <DateOpen>2014-11-26</DateOpen>
                  </DaysOpen>
            </Class>
      </Site>
</Agency>


The only difference between the two records is the <DateOpen> date. My intention is for all values of <DateOpen> to appear under the same parent like so:

Code:

<Agency>
   <AgencyName>Development Center</AgencyName>
   <aC_ProgramID>879</aC_ProgramID>
      <Site>
         <SiteName>Gompers-B25</SiteName>
            <Class>
               <ClassName>HS-103</ClassName>
                  <DaysOpen>
                     <Month>11</Month>
                     <DateOpen>2014-11-25</DateOpen>
                  </DaysOpen>
                  <DaysOpen>
                     <Month>11</Month>
                     <DateOpen>2014-11-26</DateOpen>
                  </DaysOpen>
            </Class>
      </Site>
</Agency>


I do not have much experience with XML, so this may be a very simple solution.

Ultimately I would like to be able to list all <DateOpen> values relative to its parent as well as all values of <Class> relative to its parent, etc, etc. As you may have guessed Agency has a one-to-many relationship with Site, which has the same relationship with Class, same with DateOpen.

The purpose of getting the data to populate is this sequence is to use the "Count" function to provide a number of DateOpen rows by class and site and agency.

Thank you in advance for any direction.


Kiamarz attached the following image(s):
Capture.PNG

island
Posted: Friday, February 20, 2015 5:49:14 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
Hi,

use grouping, specifically "group-by" see attached mapping example and screenshot.


File Attachment(s):
test.zip (3kb) downloaded 237 time(s).

island attached the following image(s):
test.png

Kiamarz
Posted: Thursday, March 5, 2015 7:33:28 PM
Rank: Member

Joined: 10/2/2012
Posts: 27
Location: Motor City
@island Thank you so much for the you spent answering my questions. That is exactly what I was looking for. Thank you!

Could you help me understand why this solution works?
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.