
Naming array keys for WordReport!!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Naming array keys for WordReport!!
You rarely go back, and I rarely go forward (still in Mc 2.5 most, sometimes up to 6.5 often), so I doubt I'll find much in my blissful ignorant state 


Re: Naming array keys for WordReport!!
Sorry to weigh in so late, but my experience with WordReport a couple of years ago was very similar. Like the author of the original post, I had to resort to WordReport templates rather than PDF because the client insisted that the reports (which included a couple hundred items) be editable.
What I learned was that whereas LC arrays are case sensitive, the keys placed in a WordReport template are *not*. (Hence, setting caseSensitive in LC makes no difference at all.) For example, I originally had a key [M] and a key [m]. Even though the array values in my LC code differed, WordReport inserted the same value into both.
As the author of the original post already guessed, the keys in a LC array must be *truly* unique, irrespective of case. So, using the above example, when I changed the keys *both* in the LC array and WordReport template to [Mbig] and [msmall], the problem was solved.
Buried in the WordReport documentation is that this is so. Although Curry suggests there using "caps when appropriate" when naming keys, he clarified in an email reply that this was just a stylistic suggestion to make keys more readable. Case still will be ignored by WordReport.
Hope this helps.
jeff k
P.S. Because the apps written for my client must handle Spanish- as well as English-language input, I found also that Spanish-language text inserted into a WordReport field is stripped of all diacriticals (e.g., the accent marks common in Spanish text), which can change the meaning of the text. To my knowledge, there is still no workaround for that intractable problem.
What I learned was that whereas LC arrays are case sensitive, the keys placed in a WordReport template are *not*. (Hence, setting caseSensitive in LC makes no difference at all.) For example, I originally had a key [M] and a key [m]. Even though the array values in my LC code differed, WordReport inserted the same value into both.
As the author of the original post already guessed, the keys in a LC array must be *truly* unique, irrespective of case. So, using the above example, when I changed the keys *both* in the LC array and WordReport template to [Mbig] and [msmall], the problem was solved.
Buried in the WordReport documentation is that this is so. Although Curry suggests there using "caps when appropriate" when naming keys, he clarified in an email reply that this was just a stylistic suggestion to make keys more readable. Case still will be ignored by WordReport.
Hope this helps.
jeff k
P.S. Because the apps written for my client must handle Spanish- as well as English-language input, I found also that Spanish-language text inserted into a WordReport field is stripped of all diacriticals (e.g., the accent marks common in Spanish text), which can change the meaning of the text. To my knowledge, there is still no workaround for that intractable problem.
-
- VIP Livecode Opensource Backer
- Posts: 10049
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Naming array keys for WordReport!!
I had thought so too, but I can't explain this anomaly, which I've verified on my own machine:
https://forums.livecode.com/viewtopic.p ... 75#p184524
Bug report?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Naming array keys for WordReport!!
Richard --
You may very well be right that -- as speculated also by several contributors to this thread -- there are anomalies in how different versions of LC handle case in array keys. I can't test this myself with recent versions of LC, inasmuch as LC 9.x won't run under my macOS 10.6.8 Snow Leopard.
Still, it seems to me that, as a general rule, giving each array key a unique name -- not distinguished merely by differences in case -- may be an adequate workaround (and perhaps even best practice). This should at least address the problem with WordReport that began this thread.
Best,
jeff k
You may very well be right that -- as speculated also by several contributors to this thread -- there are anomalies in how different versions of LC handle case in array keys. I can't test this myself with recent versions of LC, inasmuch as LC 9.x won't run under my macOS 10.6.8 Snow Leopard.
Still, it seems to me that, as a general rule, giving each array key a unique name -- not distinguished merely by differences in case -- may be an adequate workaround (and perhaps even best practice). This should at least address the problem with WordReport that began this thread.
Best,
jeff k
Re: Naming array keys for WordReport!!
Hi.
With LC, case does not matter. Or does it?
The issue here, and I know nothing of WordReport, being only interested in how LC works, is that different versions seem to treat the case of the keys of an array differently. That is newsWorthy, for better or worse.
I have always wanted a preference that would force the distinction, just because.
There are other things going on here, as per my post of about six back. I will try to test that a bit in v.9, and let Bogs test in v.1, or wherever he is right now.
Craig
With LC, case does not matter. Or does it?
The issue here, and I know nothing of WordReport, being only interested in how LC works, is that different versions seem to treat the case of the keys of an array differently. That is newsWorthy, for better or worse.
I have always wanted a preference that would force the distinction, just because.
There are other things going on here, as per my post of about six back. I will try to test that a bit in v.9, and let Bogs test in v.1, or wherever he is right now.
Craig
Re: Naming array keys for WordReport!!
Sorry it took so long to get back to this, but I have a lot on the plate as it were at the moment (and for the next year)

In Rev 1.1, it comes out as you (might) think that it should, with caseSensitive being enough to separate the keys. It was the same in Mc 2.5... ...and again in Rev 2.8 it seems to work... So those two are covered as good

The code of course generously donated by Craig about 8 posts ago.
Code: Select all
set the casesensitive to true
put "UP" into tArray["a"]
put "DOWN" into tArray["A"]
# my addition to it...
put tArray into tmpCombine
combine tmpCombine with return and tab
answer tmpCombine
Craig, what are you running these tests on, OSX or Win?

Re: Naming array keys for WordReport!!
Bogs.
Mac.
What is Windows?
Craig
Mac.
What is Windows?
Craig