forcing a number to be interpreted as a field name

Mark Schonewille m.schonewille at economy-x-talk.com
Tue May 30 20:12:47 EDT 2017


You shouldn't use numbers and constants as names for fields. One and 1 
are identical and field "one" as well as field "1" may be interpreted as 
the first field rather than the field with name "one" or "1".

Instead always start control names with a letter or a symbol that isn't 
a number. For example, you could start all names with n and write a loop 
like

repeat with x = 1 to 10
   set the numberformat to "00"
   put fld ("n" & x*1) into myValue
   -- do something with myValue here
end repeat

Kind regards,

Mark Schonewille
http://economy-x-talk.com
https://www.facebook.com/marksch

Buy the most extensive book on the
LiveCode language:
http://livecodebeginner.economy-x-talk.com

Op 31-May-17 om 01:59 schreef Dr. Hawkins via use-livecode:
> I have, due to the government's wisdom, checkboxes I have to use to display
> numeric values.  I've created my own to make them the right size, and to
> function as parts of groups.
>
> But looping through, with the fields in these things named for the possible
> values (usually text), I have to refer to them.
>
> So I have value of  (0,1,2) for one of these
>
>
> I need to loop through these values to set the field with the corresponding
> name.
>
> Having a value of zero in vl, how do can I refer to the field named "0" in
> group tgGrp?
>
> When this isn't a calculated value, I do it by name (zero, one, etc.), but
> that isn't an option sometimes.
>




More information about the use-livecode mailing list