I attempting to create an array based on multiple xml files then filter the array based on one of the elements of the array. Initially I start by creating one array to combine data from all of the xml files. The first code loops thru an array m.guide based on the number of elements I have stored in guidecount. It takes each element which is a url to an xml file on my server, puts it thru UrlTransfer (done in cURLGUIDE(cid)) function not shown. This creates the xml element. I loop thru this xml to add to array xmlguide.
'**********************BUILD INITIAL ARRAY****************************************************
xmlguide=[]
y=0 'programs in file
x=0 'xml file
cid=m.guide[x]
xml=cURLGUIDE(cid)
while x < guidecount - 1
for each programme in xml.programme
xmlguide.Push({
programme: {date: xml.programme@start}
programme: {title: xml.programme.title.gettext()}
programme: {desc: xml.programme.desc.gettext()}
})
end for
x=x+1
if x>guidecount-1
exit while
else
cid=m.guide[x]
xml=cURLGUIDE(cid)
end if
end while
?"TOTAL IN xmlguide. . . . "xmlguide.count()
The first part works.
Second part, I wish to filter the xmlguide based on the date. I want to create another array where only the title and desc are added if the date already exist, if it is a new date, add the date, title and desc. This is where I am stuck, not sure how to compare the current date to other dates to see if it already exist and if not to push it to an array along with the title and desc. Any help appreciated.