Set Variable or CustomProperty Names with and expression
dunbarx at aol.com
dunbarx at aol.com
Wed Aug 12 09:54:02 EDT 2015
This is a classic case of a line of code needing and extra level of evaluation. Goes back to 1987.
So, arrays notwithstanding, which "parse" sections of code intrinsically, you could:
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
Which way is a matter of style.
Craig Newman
-----Original Message-----
From: Brahmanathaswami <brahma at hindu.org>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Wed, Aug 12, 2015 12:43 am
Subject: Set Variable or CustomProperty Names with and expression
I want to move data from one variable to several others by parsing one
and
passing them to another (s)
In this scenario... the variable I want to pass
them to needs to be
named according to one of the search items
like
this:
where I want variable based on category names
like:
lifeset
godset
meditation set
etc.
categories are
e.g.
life,god,meditation
-----------
repeat for each line x in
gAllQuotes
repeat for each item y in tCategories
if item 6
of x contains y then
put x & cr & "|" after ("t" &y&"set")
end repeat
end repeat
set the uLifeSet of this stack to
tlifeset
-------------------
But apparently this is illegal... a variable
name cannot be the result
of an expression.
I suppose I should think about
using arrays, but this is a very small
amount of text data (less than 200K of
line/tab delimited data) and I
never found the processing time for just
parsing delimited text to be
that serious an issue...
Any clues? I'll sleep
on this...perhaps get an answer in a dream tonite.
If not, I'll be looking
for one
here
BR
_______________________________________________
use-livecode
mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe,
unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list