|
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):
|
|
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):
|
|
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?
|
|
guest |