Adding 1 to an array

Jim Ault JimAultWins at yahoo.com
Sat Jun 23 20:40:38 EDT 2007


Does the list of tags change or is it static?
One approach could be storing the hit counts in custom properties in
different objects (eg. cards or buttons) or different property sets...
or 
using a single array that has a double key  (+ the filter command to do
reporting, cross tabulation and tallies)

I have done both and for simpler stats, prefer the last method implemented
as a single custom property set of the card or stack.  Of course, I also
like to do a periodic 'save this stack' which is a benefit of custom
properties.

Think of a single custom property set == one array
...
set the custompropertysets of this card to "XMLset"
set the custom properties of this card to xmlHitCountArray

--------
put "IMG" into tagg
put empty into arrayKeyList
if "html" then put " htmlHit" after arrayKeyList
if "xml" then put " htmlHit" after arrayKeyList
repeat for each word WRD in arrayKeyList
   add 1 to doubleKeyArr[WRD&"^"&tagg]
end repeat

set the custom properties of this card to doubleKeyArr
get doubleKeyArr
combine using cr and tab
filter it with "*" & tagg & "*"
answer "Tag " & tagg & " shows tally of " & cr & it

you get the idea.

Jim Ault
Las Vegas

On 6/23/07 3:44 PM, "David Bovill" <david at openpartnership.net> wrote:

> On 23/06/07, Jim Ault <JimAultWins at yahoo.com> wrote:
> 
>> There must be more to the story, but why not use two lines and forget the
>> function call?
>> 
>> get "hello,1"
>> split it using cr and comma
> 
> 
> Yes - the story is I was looking for the fastest way I could think of
> combining hit counts for tags. That is if I have one list (I call them
> indexes if they are CR delimited) for items tagged "xml" and another for
> "html" etc and one item could be in several lists... well I was thinking it
> would be a lot faster to use built in array commands than to repeat over
> keys or lines. So I was thinking of doing intersects of arrays and adding 1
> to each element in the resulting intersect as a way of generating hit
> counts:
> 
> put xmlHitCountArray into doubleHitArray
> intersect doubleHitArray with htmlHitCountArrray
> add 1 to xmlHitCountArray
> _______________________________________________
> 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





More information about the use-livecode mailing list