Naming array keys for WordReport!!

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Naming array keys for WordReport!!

Post by bogs » Tue Oct 22, 2019 9:51 pm

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 :wink:
Image

jmk_phd
Posts: 216
Joined: Sat Apr 15, 2017 8:29 pm

Re: Naming array keys for WordReport!!

Post by jmk_phd » Wed Oct 23, 2019 8:46 pm

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Naming array keys for WordReport!!

Post by FourthWorld » Wed Oct 23, 2019 8:57 pm

jmk_phd wrote:
Wed Oct 23, 2019 8:46 pm
What I learned was that whereas LC arrays are case sensitive...
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

jmk_phd
Posts: 216
Joined: Sat Apr 15, 2017 8:29 pm

Re: Naming array keys for WordReport!!

Post by jmk_phd » Wed Oct 23, 2019 9:38 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Naming array keys for WordReport!!

Post by dunbarx » Wed Oct 23, 2019 10:02 pm

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

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Naming array keys for WordReport!!

Post by bogs » Thu Oct 24, 2019 9:18 pm

dunbarx wrote:
Wed Oct 23, 2019 10:02 pm
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.
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) :shock:
In Rev 1.1, it comes out as you (might) think that it should, with caseSensitive being enough to separate the keys.
Oct_24_2019_caseSensitiveArrays.png
Up...down...uh huh...
It was the same in Mc 2.5...
Oct_24_2019_caseSensitiveArrays-MetaCard.png
Metacard oh metacard...
...and again in Rev 2.8 it seems to work...
Oct_24_2019_Rev2-8.png
Gonna go round in circles...
So those two are covered as good :D

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
Hmm. I wonder if my results are being determined because this is a 'nix box?

Craig, what are you running these tests on, OSX or Win?
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Naming array keys for WordReport!!

Post by dunbarx » Fri Oct 25, 2019 3:11 am

Bogs.

Mac.

What is Windows?

Craig

Post Reply