Dimensional Arrays

Nic Prioleau nickp at didata.bw
Wed Mar 14 07:03:08 EDT 2007


I appologise in advance for what may seem like simple programming logic to 
some, but I'm not really a programmer and I've been staring at this problem 
for 5 hours now and can't seem to figure it out. I have 3 multi-dimensional 
arrays which I need to get "grouped" information out of:-

tArray1["Data",1,"regNo"] = "B123ABC"
tArray1["Data,1,"tLitres"] = "500"
tArray1["Data",1,"month"] = 2
tArray1["Data",2,"regNo"] = "B123ABC"
tArray1["Data,2,"tLitres"] = "300"
tArray1["Data",2,"month"] = 3
tArray1["Data",3,"regNo"] = "B456ABC"
tArray1["Data,3,"tLitres"] = "200"
tArray1["Data",3,"month"] = 4

tArray2["Data",1,"regNo"] = "B123ABC"
tArray2["Data",1,"tLitres"] = "1000"
tArray2["Data",1,"tKM"] = "2500"
tArray2["Data",1,"month"] = 2
tArray2["Data",2,"regNo"] = "B123ABC"
tArray2["Data,2,"tLitres"] = "150"
tArray2["Data",2,"tKM"] = "3000"
tArray2["Data",2,"month"] = 3
tArray2["Data",3,"regNo"] = "B456ABC"
tArray2["Data,3,"tLitres"] = "150"
tArray2["Data",3,"tKM"] = "3000"
tArray2["Data",3,"month"] = 4

AND....
tArray3["Data",1,"regNo"] = "B123ABC"
tArray3["Data",1,"tLitres"] = "350"
tArray3["Data",1,"tKM"] = "800"
tArray3["Data",1,"month"] = 2
tArray3["Data",2,"regNo"] = "B123ABC"
tArray3["Data,2,"tLitres"] = "250"
tArray3["Data",2,"tKM"] = "600"
tArray3["Data",2,"month"] = 3
tArray3["Data",3,"regNo"] = "B456ABC"
tArray3["Data,3,"tLitres"] = "250"
tArray3["Data",3,"tKM"] = "100"
tArray3["Data",3,"month"] = 4

what I need to end up with is data from these 3 arrays which will end up 
looking something like this:

regNo "B123ABC" used 1850Ltrs and did 3300 km in month 2
regNo "B123ABC" used 700Ltrs and did 3600 km in month 3
regNo "B456ABC" used 500Ltrs and did 3100 km in month 4

Can anyone explain how I might be able to do this. I basically got the info 
by doing 3 'grouped' select statements from 3 different tables. This info 
gets stored in the arrays above but when it comes time to writing a report 
or doing calculations, I need to add them all up. It's probably staring me 
in the face but I have 'arc eye' from staring at the screen for so long!

Mighty appreciative! 


#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal
#####################################################################################



More information about the use-livecode mailing list