Nesting multiple tables/queries on export to XML



Is there any way to use the Application.ExportXML method to not only merge multiple queries, but to nest the queries inside each other?


For example, let's say I have three tables. I'm already able to use the Application.ExportXML method to merge the three together. The main queries that I don't want repeating don't repeat, and the one with all the customer info does. Good.


But it comes out like this (for various paranoid reasons I'm using fake data):



<DogCare>
<Facility>Twin Peaks</Facility>
<Year>1992</Year>
<Month>1</Month>
</DogCare>
<DogTeam>
<Team>DogWalker</Team>
<DogsWalked>24</DogsWalked>
<TreatsGiven>900</TreatsGiven>
</DogTeam>
<PetWalkTime>
<Name>Palmer</Name>
<Age>7</Age>
<FavoriteSnack>Cheese</FavoriteSnack>
<FavThingtoDo>Chew Shoes</FavThingtoDo>
<Day>1</Day>
<DidBusiness>Yes</DidBusiness>
<Barked>Constantly</Barked>
<PulledonLeash>Whole Time</PulledonLeash>
<DeservesTreat>Gave it Anyway</DeservesTreat>
</PetWalkTime>
<PetWalkTime>
<Name>Laura</Name>
<Age>5</Age>
<FavoriteSnack>Pie</FavoriteSnack>
<FavThingtoDo>Fetch</FavThingtoDo>
<Day>1</Day>
<DidBusiness>Yes</DidBusiness>
<Barked>No</Barked>
<PulledonLeash>No</PulledonLeash>
<DeservesTreat>Gave Several</DeservesTreat>
</PetWalkTime>


Now. "DogCare","DogTeam", and "PetWalkTime" are separate queries. Yet, they are all related and belong within each other like so:



<DogCare>
<Facility>Twin Peaks</Facility>
<Year>1992</Year>
<Month>2</Month>
<DogTeam>
<Team>DogWalker</Team>
<DogsWalked>24</DogsWalked>
<TreatsGiven>900</TreatsGiven>
<PetWalkTime>
<Name>Palmer</Name>
<FavoriteSnack>Cheese</FavoriteSnack>
<FavThingtoDo>Chew Shoes</FavThingtoDo>
<Day>1</Day>
<DidBusiness>Yes</DidBusiness>
<Barked>Constantly</Barked>
<PulledonLeash>Whole Time</PulledonLeash>
<DeservesTreat>Gave it Anyway</DeservesTreat>
</PetWalkTime>
<PetWalkTime>
<Name>Laura</Name>
<FavoriteSnack>Pie</FavoriteSnack>
<FavThingtoDo>Fetch</FavThingtoDo>
<Day>1</Day>
<DidBusiness>Yes</DidBusiness>
<Barked>No</Barked>
<PulledonLeash>No</PulledonLeash>
<DeservesTreat>Gave Several</DeservesTreat>
</PetWalkTime>
</DogTeam>
</DogCare>


Is there any way to make that last one possible on export?


No comments:

Post a Comment