Re: Multidimensional array issue

2021-03-11 Thread HENRY LOWE via use-livecode
Thank you to everyone for help in resolving this issue. The syntax for determining if tArray[“status”] contains data or an array appears to be either: If the value of tArray[“status”] is not empty // contains data or If tArray[“status”] is not an array // contains data If I remember correctly

Re: Multidimensional array issue

2021-03-10 Thread Tom Glod via use-livecode
>> (tArray["key1","key1.1"]["key2","key2.1"]) Sean never even thought about this form of arrays. I gotta test the functionality of this. Thanks. I know you are busy, but if you have the time, feel free to blow my mind. On Wed, Mar 10, 2021 at 8:12 PM Sean Cole (Pi) via use-liveco

Re: Multidimensional array issue

2021-03-10 Thread Sean Cole (Pi) via use-livecode
In the message box: > put "data" into tArray["key1"]["key2"]; answer the value of tArray["key1”] > - returns EMPTY (so this works) Correct put "data" into tArray["key1"]["key2"]; answer tArray["key1”] is empty - > returns FALSE (it should return true IMHO) Because it is not empty. It has a ne

Re: Multidimensional array issue

2021-03-10 Thread Jim Lambert via use-livecode
This is a very interesting discussion of LC arrays. But back to the original post: > HENRY LOWE wrote: > > I am using multidimensional arrays to process data read from JSON files. > Some of the data in the JSON files can be represented in alternative forms in > files from different sources. > F

Re: Multidimensional array issue

2021-03-10 Thread Bob Sneidar via use-livecode
What he said. :-) Bob S On Mar 9, 2021, at 10:19 AM, Ralph DiMola via use-livecode mailto:use-livecode@lists.runrev.com>> wrote: If (not(tArray[“status”] is an array)) and (tArray[“status”] is not empty) then -- ***tArray[“status”] is not an array and is not empty. As MW said empty is technic

Re: Multidimensional array issue

2021-03-10 Thread Bob Sneidar via use-livecode
If tArray [“status”] is an array or tArray [“status”] is not empty It’s an odd array structure though if a key can contain either. Bob S On Mar 9, 2021, at 10:02 AM, HENRY LOWE via use-livecode mailto:use-livecode@lists.runrev.com>> wrote: Thanks to all for your excellent discussion and sugge

Re: Multidimensional array issue

2021-03-09 Thread Mark Wieder via use-livecode
On 3/9/21 10:02 AM, HENRY LOWE via use-livecode wrote: put "data" into tArray["key1"]["key2"]; answer tArray["key1”] is an array - returns TRUE (so not helpful) Not sure why this isn't helpful. Of course it's an array. And tArray["key1"]["key2"] is *not* an array and contains the value. None

RE: Multidimensional array issue

2021-03-09 Thread Ralph DiMola via use-livecode
...@lists.runrev.com] On Behalf Of HENRY LOWE via use-livecode Sent: Tuesday, March 09, 2021 1:03 PM To: Nabble-Livecode-List Cc: HENRY LOWE Subject: Re: Multidimensional array issue Thanks to all for your excellent discussion and suggestions. To briefly restate the problem: If tArray[“status

Re: Multidimensional array issue

2021-03-09 Thread Brian Milby via use-livecode
Try this: put tArray[“status”][“text”] into tStatus If tStatus is empty then Put tArray[“status”] into tStatus End if Sent from my iPhone ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe an

Re: Multidimensional array issue

2021-03-09 Thread HENRY LOWE via use-livecode
Thanks to all for your excellent discussion and suggestions. To briefly restate the problem: If tArray[“status”] does not contain a value and If tArray[“status”][“text”] contains a value How do I determine if tArray[“status”] contains a value? In the message box: put "data" into tArray["k

Re: Multidimensional array issue

2021-03-09 Thread HENRY LOWE via use-livecode
Thanks to all for your excellent discussion and suggestions. To briefly restate the problem: If tArray[=E2=80=9Cstatus=E2=80=9D] does not contain a value and If tArray[=E2=80=9Cstatus=E2=80=9D][=E2=80=9Ctext=E2=80=9D] contains a = value How do I determine if tArray[=E2=80=9Cstatus=E2=80=9D]

RE: Multidimensional array issue

2021-03-09 Thread Ralph DiMola via use-livecode
-boun...@lists.runrev.com] On Behalf Of Bob Sneidar via use-livecode Sent: Tuesday, March 09, 2021 12:24 PM To: How to use LiveCode Cc: Bob Sneidar Subject: Re: Multidimensional array issue The trouble is, if tDataA [“item”] variable does not exist, that is it is not an array, you will still get empty. Bob S

Re: Multidimensional array issue

2021-03-09 Thread Bob Sneidar via use-livecode
The trouble is, if tDataA [“item”] variable does not exist, that is it is not an array, you will still get empty. Bob S On Mar 8, 2021, at 9:16 PM, Phil Davis via use-livecode mailto:use-livecode@lists.runrev.com>> wrote: When I want to determine whether or not an array element contains non-

Re: Multidimensional array issue

2021-03-09 Thread Sean Cole (Pi) via use-livecode
You might also want to make use of the 'strictly' keyword in case there are any nested arrays in your base array. Your use case may not venture that far but it is maybe worth just applying it anyway. *put* (atest is strictly an array) Sean On Tue, 9 Mar 2021 at 16:09, Sean Cole (Pi) wrote: > *

Re: Multidimensional array issue

2021-03-09 Thread Mark Wieder via use-livecode
On 3/8/21 9:16 PM, Phil Davis via use-livecode wrote: When I want to determine whether or not an array element contains non-whitespace, I usually say:     if word 1 of tDataA["item"] is empty then ... (or is NOT empty) The problem with that is that it doesn't differentiate between an empty

Re: Multidimensional array issue

2021-03-09 Thread Sean Cole (Pi) via use-livecode
*put* empty into atest["test1"]; *put* 1 into atest["test2"]; *put* 3 into atest["test3"]["test3.1"]; *put* (atest is an array) , (atest["test1"] is an array) , (atest["test2"] is an array) , (atest["test3"] is an array) true,false,false,true Seems fine to me. Sean _

Re: Multidimensional array issue

2021-03-09 Thread David V Glasgow via use-livecode
Er, I think I have just reached the fourth level of array un-enlightenment. Wait!…. I can see the cyberverse! SCHLOOOppp!-ting! > On 3/8/21 5:36 PM, Bob Sneidar via use-livecode wrote: >> Are you testing for empty, or are you testing if there is a value in an >> array variable? If there is

Re: Multidimensional array issue

2021-03-08 Thread Phil Davis via use-livecode
When I want to determine whether or not an array element contains non-whitespace, I usually say:     if word 1 of tDataA["item"] is empty then ... (or is NOT empty) Just another option. Phil Davis On 3/8/21 5:36 PM, Bob Sneidar via use-livecode wrote: Are you testing for empty, or are you

Re: Multidimensional array issue

2021-03-08 Thread Bob Sneidar via use-livecode
Are you testing for empty, or are you testing if there is a value in an array variable? If there is no key matching your array variable, LC will return an empty string. An empty string is a value. Mark is using a different method, seeing if a key of an array is itself an array. If bobtest ["va

Re: Multidimensional array issue

2021-03-08 Thread Mark Wieder via use-livecode
On 3/8/21 4:58 PM, Ralph DiMola via use-livecode wrote: Also works, if tArray[“status”] an array -- It's an array if (not (tArray[“status”] an array)) and (tArray[“status”] is not empty) -- it's a value Well, technically "empty" is also a value. Just an... er... empty one. -- Mark Wiede

RE: Multidimensional array issue

2021-03-08 Thread Ralph DiMola via use-livecode
mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of HENRY LOWE via use-livecode Sent: Monday, March 08, 2021 7:26 PM To: Nabble-Livecode-List Cc: HENRY LOWE Subject: Re: Multidimensional array issue Thanks Mark. There are two possible states: tArray[“status”] holds a value and tArray[“status”][“t

Re: Multidimensional array issue

2021-03-08 Thread Mark Wieder via use-livecode
On 3/8/21 4:25 PM, HENRY LOWE via use-livecode wrote: My code is trying to do the following: No, I *do* see what you're trying to do. Here... try it for yourself: on mouseUp pMouseBtnNo local tArray put "hello" into tArray["status"] put tArray["status"] is an array into msg # false

RE: Multidimensional array issue

2021-03-08 Thread Ralph DiMola via use-livecode
.com] On Behalf Of HENRY LOWE via use-livecode Sent: Monday, March 08, 2021 7:26 PM To: Nabble-Livecode-List Cc: HENRY LOWE Subject: Re: Multidimensional array issue Thanks Mark. There are two possible states: tArray[“status”] holds a value and tArray[“status”][“text”] does not or tArray[“status

RE: Multidimensional array issue

2021-03-08 Thread Ralph DiMola via use-livecode
ode Sent: Monday, March 08, 2021 7:26 PM To: Nabble-Livecode-List Cc: HENRY LOWE Subject: Re: Multidimensional array issue Thanks Mark. There are two possible states: tArray[“status”] holds a value and tArray[“status”][“text”] does not or tArray[“status”][“text”] holds a value and tArray[“status”]

Re: Multidimensional array issue

2021-03-08 Thread HENRY LOWE via use-livecode
Thanks Mark. There are two possible states: tArray[“status”] holds a value and tArray[“status”][“text”] does not or tArray[“status”][“text”] holds a value and tArray[“status”] does not My code is trying to do the following: If tArray[“status”] does not hold a value then check if tArray[“stat

Re: Multidimensional array issue

2021-03-08 Thread Mark Wieder via use-livecode
On 3/8/21 3:46 PM, HENRY LOWE via use-livecode wrote: I have often used the form 'if tArray[“key1”] is empty' to determine whether an array element hold a value but this breaks if tArray[“key1”][“key2”] holds a value. Same here. Not that I've every liked that paradigm, just that it's been t

Multidimensional array issue

2021-03-08 Thread HENRY LOWE via use-livecode
I am using multidimensional arrays to process data read from JSON files. Some of the data in the JSON files can be represented in alternative forms in files from different sources. For example a field named “status” may be represented as either: “status": { "text": “active"} or “status":