We are not talking about different things, but the same thing from different 
angles. I misinterpreted what you wanted to do from your example. What you do 
manually is creating an associative array with a numeric array as the values 
for each key in the associative array, which should work well. I should learn 
to read before I write, just as I should learn to listen for the questions 
before I give the answers. My students have told me as much, more than once! :-)


Best Regards 
Tore







> 19. sep. 2018 kl. 00:01 skrev Sannyasin Brahmanathaswami via use-livecode 
> <use-livecode@lists.runrev.com>:
> 
> Tore, must be talking about different things.
> 
> fld "tQuote" =
> 
> Cut the apple. Cut the banana.
> 
> 
> I CAN manually create what we need
> 
> *on*mouseup
> 
> *    put*"100,320"intoWordLocationsA["Cut"][1]
> 
> *    put*"300,320"intoWordLocationsA["Cut"][2]
> 
> *    put*"200,320"intoWordLocationsA["the"][1]
> 
> *    put*"400,320"intoWordLocationsA["the"][2]
> 
> *    put*"500,320"intoWordLocationsA["apple"][1]
> 
> *    put*"700,320"intoWordLocationsA["banana"][1]
> 
> *    put*thekeysofWordLocationsA
> 
> *end*mouseup
> 
> 
> Craig has almost got it
> 
> 
> *on*mouseUp
> 
> *    repeat* withy = 1tothenumberofwordsoffld"tQuote"
> 
> *        put*wordy offld"tQuote"intotWord
> 
> *        select*wordy offldtQuote
> 
> *        put*theselectedLocintowordLocationA[tWord][x]
> 
> *    end* *repeat*
> 
> *end*mouseUp
> 
> # how to get "x" to increment? but only by each key in the array?
> 
> *on*mouseup
> 
> *    repeat* withy = 1tothenumberofwordsoffld"tQuote"
> 
> *        select*wordy offld"tQuote"
> 
> *        put*wordy offld"tQuote"&"|"& theselectedLoc& crafterwordLocationsA
> 
> *    end* *repeat*
> 
> *    delete*char-1 ofwordLocationsA
> 
> *    split*wordLocationsA bycrand"|"
> 
> *    put*thekeysofwordLocationsA intofld"result"
> 
> *end*mouseUp
> 
> #only on location is saved (of course)
> 
> 
> 
> 
> 
> 
> 
> On 9/18/18 7:15 AM, Tore Nilsen via use-livecode wrote:
>> You can not put the incrementing numeric key inside an associative array the 
>> way you want. The key of any array must be unique, and you can not have 
>> several instances of a key in an array. Think of the keys of the array it as 
>> the primary keys of a database table. It serves as a unique identifier.
>> 
>> Best regards
>> Tore Nilsen
>> 
>> 
>> 
>> 
>> 
>>> 18. sep. 2018 kl. 17:41 skrev Sannyasin Brahmanathaswami via use-livecode 
>>> <use-livecode@lists.runrev.com>:
>>> 
>>> My head always breaks on complex array functions. I can't head around
>>> this algorithm
>>> 
>>> Given a "quote"  in a field
>>> 
>>> "Cut the apple. Cut the banana"
>>> 
>>> We get to location for each word (that is easy) 
>>> 
>>> I want to analyse the quote by going through each word.
>>> 
>>> *----------*
>>> 
>>> *repeat* withx = 1tothenumberofwordsoffld"_quote"
>>> 
>>>   # get the location of the word, put it into variable tWordLocation
>>> 
>>>   put tWordLocation to the WordLocationA[x][??][tWordLocation]
>>> 
>>> end repeat
>>> 
>>> -------
>>> 
>>> that we end with
>>> 
>>> WordLocationA["Cut"][1][100,320]
>>> WordLocationA["Cut"][2][300,320]
>>> WordLocationA["the"][1][200,320]
>>> WordLocationA["the"][2][400,320]
>>> WordLocationA["apple"][2][500,320]
>>> WordLocationA["banana"][2][500,320]
>>> 
>>> the "part" where incrementing the numeric key inside the repeat loop,
>>> "inside" the key,  I can't get.
>>> 
>>> BR
>>> 
>>> 
>>> 
>>> 
>>> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to