Parsing arrays
Posted: Tue Dec 31, 2019 12:51 am
Hi all...
As usual, I'm hoping this is some quirk of Livecode that has a simple fix. I'm writing a routine that updates our company database with data from the SQLite db file associated with our remote support software. The database calls are working fine and the result (using test parameters) is an array with 71 keys, each of which has 10 subkeys.
However, when I try to parse the array like this:
I get an error that says Array: bad index expression on the very first put statement.
If I do it this way:
It goes through each line as expected but puts none of the data into the variables. They're all blank.
I tried re-installing Livecode Community 9.5 and then I updated it to 9.5.1, because once a few years ago something got corrupted and it was causing strange errors. But that didn't do anything except keep me occupied for 15 minutes.
Dave
As usual, I'm hoping this is some quirk of Livecode that has a simple fix. I'm writing a routine that updates our company database with data from the SQLite db file associated with our remote support software. The database calls are working fine and the result (using test parameters) is an array with 71 keys, each of which has 10 subkeys.
However, when I try to parse the array like this:
Code: Select all
repeat for each element x in myArray
put myArray[x][1] into tvMake
put myArray[x][2] into tvModel
put myArray[x][3] into tvCompName
put myArray[x][4] into tvProdNum
put myArray[x][5] into tvSerial
put myArray[x][6] into tvOSName
put myArray[x][7] into tvProcessor
etc...
If I do it this way:
Code: Select all
put the number of elements in myArray into tvLong
repeat with x = 1 to tvLong
put myArray[x][1] into tvMake
put myArray[x][2] into tvModel
put myArray[x][3] into tvCompName
put myArray[x][4] into tvProdNum
put myArray[x][5] into tvSerial
put myArray[x][6] into tvOSName
put myArray[x][7] into tvProcessor
etc...
I tried re-installing Livecode Community 9.5 and then I updated it to 9.5.1, because once a few years ago something got corrupted and it was causing strange errors. But that didn't do anything except keep me occupied for 15 minutes.
Dave