Dimensional Arrays

Nic Prioleau nickp at didata.bw
Wed Mar 14 11:11:36 EDT 2007


Hi Kev,

Thanks for your feedback however, I managed to get something like this:

regNo,totalFuel,totalKM,month
B456TRF,1000,0,2
B456TRF,150,0,3
B456TRF,0,376,3
B444AAA,50,0,3
B444AAA,340,3000,3
B444AAA,0,600,3

into a variable from my selects... Could you tell me how I can achieve the 
same result as I was trying to get before as I have now eliminated the other 
arrays I had. It was too messy and because they did not have the same keys, 
it was difficult to get an accurate result.

thanks muchly
Nic

----- Original Message ----- 
From: "Ken Ray" <kray at sonsothunder.com>
To: "How to use Revolution" <use-revolution at lists.runrev.com>
Sent: Wednesday, March 14, 2007 3:54 PM
Subject: Re: Dimensional Arrays


> Honestly, I didn't know you could have multiple quoted strings in a key
> and have it work (learn something new every day!). However to grab your
> data you could do this:
>
> -- If you have a fixed set of 3 arrays which have the same keys:
> put "B123ABC" into tRegNo
> put "2" into tMonth
> put "" into tReport
> repeat for each line tKey in (the keys of tArray1)
>  if item 3 of tKey is "month" then
>    put tArray1[tKey] into tMonth
>    put item 2 of tKey into tRecNo  -- this is the record number (I'm
> assuming)
>    put tArray1["Data," & tRecNo & ",regNo"] into tRegNo
>
>    put tArray1["Data," & tRecNo & ",tKM"] into tKM1
>    put tArray2["Data," & tRecNo & ",tKM"] into tKM2
>    put tArray3["Data," & tRecNo & ",tKM"] into tKM3
>    put tArray1["Data," & tRecNo & ",tLitres"] into tLitres1
>    put tArray2["Data," & tRecNo & ",tLitres"] into tLitres2
>    put tArray3["Data," & tRecNo & ",tLitres"] into tLitres3
>    put "regNo" && quote & tRegNo & quote && "used" && \
>       (tLitres1+tLitres2+tLitres3) & "Ltrs and did" && \
>       (tKM1+tKM2+tKM3) && "km in month" && tMonth & \
>       CR after tReport
> end repeat
> delete char -1 of tReport -- removes trailing CR
> put tReport into field 1
>
> HTH,
>
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 


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



More information about the use-livecode mailing list