how to adress the object name and not the number?
Bill Marriott
wjm at wjm.org
Fri Apr 20 04:44:02 EDT 2007
Eric,
>>>
I prefer to name any object with a single word
("LastBackupDate5" for instance) and *always* quoted even if XTalks
don't make it compulsory in this case.
And to retrieve the right suffix, instead of using last word, I just
use char x to -1:
<<<
Right! I always, always quote string literals as well, even though Rev will
handle it for me if I don't.
But on the other idea, this is exactly the problem I'm trying to solve. :)
It's cumbersome because you've got the problem of a variant number of items
and length of the label prefix.
If you have more than 10 items (as in my example) you can't use digits 0-9
and instead have to force your numbering system to two digits. Rev doesn't
comprehend "last 2 char" so you instead have to write something like
put "0" & i into n; put thePrefix & char (the length of n) to -2 of n into
itemName --for <100 items
or add a FileMaker-esque "RightString(string,numchars)" custom function to
get your "fixed length" serial number.
vs the bog-simple "put thePrefix && i into itemName" when building the
reference.
Then, when you're parsing out the item, unless all your prefixes have
exactly the same number of characters, you have to say
char (the length of itemName) to -2 of itemName
or hard-code the length of the prefix, vs "last word of itemName" which
works no matter what.
I like my system because it's more generalized. Building a name just takes
&& instead of &, and "last word" is easier/quicker for me to write and parse
than the "char x to -1" construction. I can use it in every situation
without modification, whatever prefix I select and whether it's 9 or 900
items I'm trying to keep track of.
More information about the use-livecode
mailing list