Re: forcing a number to be interpreted as a field name

2017-05-30 Thread Dr. Hawkins via use-livecode
On Tue, May 30, 2017 at 5:47 PM, Bob Sneidar via use-livecode <
use-livecode@lists.runrev.com> wrote:

> When you say "forms" do you mean "web forms" or PDF forms?


PDF forms.  Particularly badly written pdf . . . I actually recreate them
(though, at some point, if people start paying me, I'll probably switch to
putting fields of .eps, which will probably mean rewriting in swift or some
such).

The core of the program deals with the dependencies and calculating the
default values for other variables in a cascading manner.

And now I find, happily, that I accounted for this situation long ago; I
just generated a form that hadn't been used in a while.


When I have integer values, rather than field names for values, it's "cg_"
followed by the value.

And with that, all works again!


-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
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


Re: forcing a number to be interpreted as a field name

2017-05-30 Thread Bob Sneidar via use-livecode
When you say "forms" do you mean "web forms" or PDF forms? It may not matter 
much. I wrote an interface which allows the user to associate a database column 
with a PDF form control. Much the same thing could be done which would allow 
you to call your form fields anything you like. Populating and extracting data 
would use this linking system whenever going from one to the other. It's not 
the least trouble, but it is the most flexible way going forward, which is what 
I was eventually forced to concede. I resisted it for a long time. 

Bob S


> On May 30, 2017, at 17:30 , Dr. Hawkins via use-livecode 
>  wrote:
> 
> I'm a very firm believer in this, and have been since HyperCard 1.0 . . .
> 
> However, the forms changed to this stupid system after my enine was
> written, and I'm trying to find the way to accommodate this that both the
> "least hackity" and has the smallest number of rewrites.
> 
> The least painful things that I have thought of so far are
> 1) a global array with names of the numeric values, and switch to working
> with this for display when the datatype is integer
> 2) have a custom property in groups with such a translation table for the
> values used when it exists
> 
> I think I actually did a good enough job in general that there is a single
> handler that has to change!
> 
> But even these mean going from a super-clean rendition to a series of
> similar switches . . .
> 
> *argh*
> 
> 
> -- 
> Dr. Richard E. Hawkins, Esq.
> (702) 508-8462


___
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


Re: forcing a number to be interpreted as a field name

2017-05-30 Thread Dr. Hawkins via use-livecode
On Tue, May 30, 2017 at 5:12 PM, Mark Schonewille via use-livecode <
use-livecode@lists.runrev.com> wrote:

> 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.
>

I'm a very firm believer in this, and have been since HyperCard 1.0 . . .

However, the forms changed to this stupid system after my enine was
written, and I'm trying to find the way to accommodate this that both the
"least hackity" and has the smallest number of rewrites.

The least painful things that I have thought of so far are
1) a global array with names of the numeric values, and switch to working
with this for display when the datatype is integer
2) have a custom property in groups with such a translation table for the
values used when it exists

I think I actually did a good enough job in general that there is a single
handler that has to change!

But even these mean going from a super-clean rendition to a series of
similar switches . . .

*argh*


-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
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


Re: forcing a number to be interpreted as a field name

2017-05-30 Thread Mark Schonewille via use-livecode
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.



___
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


forcing a number to be interpreted as a field name

2017-05-30 Thread 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.

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
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