Any help here? Another way of putting this is show the area, run all the loop for everything in that area, thn show the end of the area before showing the next one?
Main Topics
Browse All TopicsHello-
I have the following code that puts in the change of area when a new area is available as the parent. However, I cant figure out what is the best solution for creating the closing parent tag after it has looped through the area iteration. With the current code it creates the Parent and closing parent tag after just 1 record. However, I need all records for a parent to fall within the tags. So the closing parent tag should only change when there is a new area. I am guessing and array to ubound of the count from area but not sure.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I find it a bit difficult to see the wood for the trees. I assume that you are storing your data in an XML file, which you need to update. I'd like to suggest an alternative processing strategy and also ask if you could post the structure of the file.
I do these things using an XML DOM which I create with Javascript (VBScript) :-
var xmldom = CreateObject('Microsoft.XM
xmldon.async = false;
xmldom.load('c:\dir\file.x
If it is the first time I create the file with FSO and set it to an empty document (<root></root>)
Now the entries are all of the type <entry id="someidnumber">.........
so I look for the entry to update :
var entry = xmldoc.selectSingleNode('/
if entry=nothing I create a new entry with that id and the data, select the root element and append :-
entry = xmldom.createElement('entr
...here a bit of code for all the data bits.....
var root = xmldom.documentElement;
root.appendChild(entry);
else
I have found the entry needed and can now select the data elements under it one after the other and update them
end if.
Now to write the file back I use FSO again getting the data to write by xmldom.xml or by using the xmldom.save method.
Hope that's a start.
BigRat-
Thanks for the response. My data is coming from an ADO result set and I am outputting to XML. So I am trying to create a parent tag, all data for that parent tag and then the ending parent tag. I can create the start tag from my code which works fine, however keeping track to show the end parent tag after the child nodes are complete is where i am lost as my variable is defined by the current record set not the previous.
It should go something like this :-
currentArea = ""
Do While not(getAds.EOF)
nextArea = getAds.fields("Area")
if nextArea <> currentArea then
if currentArea <>"" then
%>
</<%=Replace(Replace(Left(Ap
<%
end if
<<%=Replace(Replace(Left(App
<%
currentArea = nextArea
end if
which ensures that the pervious tag is closed when the area changes and a start tag is emitted. If you then need to refer to the area name again it is ALWAYS in the variable currentArea.
The end of the loop does NOT need to bother with the area change, so simply delete these lines :-
if nextArea <> currentArea then
%>
</<%=Replace(Replace(Left(Ap
<%
end if
Now the ONLY last problem is that after the loop has closed an end of area tag is missing, and the area name is currentArea, so simply add this code after the loop statement
%>
</<%=Replace(Replace(Left(Ap
<%
(I'm assuming here that your Replace statements are correct)
Business Accounts
Answer for Membership
by: jfergyPosted on 2009-09-17 at 21:46:13ID: 25362979
Maybe a simpler way of putting this is I need the open area tag, whatever data is in that area with <ad>, then the closing tag of that area, before putting in the new area.