Neither of these worked...

I took the cue from Mark and tried arrays

this was incredibly simple... almost.

In the end I was unable to figure out how to pass a variable string as a name of a custom property. My head was hurting, so instead of breaking it on further attempts to find the algorithm for this... I "man handled it" in the end with my usual verbose "baby xTalk"

command getAndDistributeCategories
   set the defaultstack to "Gurudeva"
put url ("file:/" & localpath()& "data/gurudeva-quotes.txt") into gAllQuotes

set the uAllQuotes of stack "Gurudeva" to gAllQuotes # line/pipe delimited
   put the uCategories of this stack into tCategories # tab delimited


   set the linedelimiter to "|"
   set the itemdelimiter to tab

   repeat for each line x in gAllQuotes

      repeat for each item y in tCategories
         put "t" & y & "Set" into tAggregatedSet
         if (item 6 of x contains y) then put x & "|" after aQuoteSets[y]
      end repeat

   end repeat

# get some stats

   repeat for each item y in tCategories
put y & " quotes: " & the number of lines of aQuoteSets[y] & cr after tCountCheck
   end repeat

put tCountCheck into url ("file:/"& localpath() & "data/quote-spread-stats.txt")

## LOAD PROPS - which is the target goal of this handler ##

# I "give up" on a more efficient method.. this works but
# has the downside of being hard-wired... so if we change the category names
# we have to manually massage this code... there must be a better way:
# you cannot do anything like
# set the ("u" & y & "Set") of this stack... the compiler complains this is illegal

   set the uKarmaQuotes of this stack to aQuoteSets["Karma"]
   set the uHinduismQuotes of this stack to aQuoteSets["Hinduism"]
   set the uSivaQuotes of this stack to aQuoteSets["Siva"]
   set the uWisdomQuotes of this stack to aQuoteSets["Wisdom"]
   set the uLifeQuotes of this stack to aQuoteSets["Life"]
   set the uGuruQuotes of this stack to aQuoteSets["Guru"]
   set the uSelfQuotes of this stack to aQuoteSets["Self"]
   set the uGodsQuotes of this stack to aQuoteSets["Gods"]
   set the uHumorQuotes of this stack to aQuoteSets["Humor"]
   set the uMeditationQuotes of this stack to aQuoteSets["Meditation"]
   set the uSadhanaQuotes of this stack to aQuoteSets["Sadhana"]
   set the uWorshipQuotes of this stack to aQuoteSets["Worship"]

end getAndDistributeCategories

So this is the same issue: setting variable name or CustomProp name with an expression.

Swasti Astu, Be Well!
Brahmanathaswami

Kauai's Hindu Monastery
www.HimalayanAcademy.com



dunb...@aol.com wrote:
    repeat for each item y in tCategories
          do "if item 6 of"&&  x&&  "contains"&&  y&&  "then put"&&  x&&  "&"&&  cr&  "| after"&& 
 t&  y&  "set"
    end repeat


or:


  repeat for each item y in tCategories
          get ("t"&  y&  "set")
          if item 6 of x contains y then put x&  cr&  "|" after it
   end repeat


_______________________________________________
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