Multi-dimensional array
Ninox Profile

I'm just pointing this out. The Table is an array of objects and it can be assigned to a variable. I don't know what the size limitations are, however. If you made a Table generic enough, you could make a global variable 2-dimensional array. You would assign the Table like this...

 

let myArr := select YourTable

or

let myArr := select YourTable where YourField = yourValue

or

let myArr := ((select YourTable) order by YourField)

or

let myArr := ((select YourTable where YourField = yourValue) order by YourField)

 

You can access the elements of the array like this...

 

item(myArr, idx).YourField

 

You can also assign a value to an element this way and it will be saved to the Table...

 

item(myArr, idx).YourField := "BlaBlaBla"

Ninox Profile

@Sean ... That is an interesting approach... basically creating an array of records.    

I have been thinking about using a table of multi-line text fields in conjunction with the formatJSON and parseJSON functions to support dynamic multi dimensional arrays.. 

Ninox Profile

@Mconneen, I haven't spent enough time with the API to understand what you describe. I guess I'm getting tripped up on "support".

 

The approach I'm suggesting is definitely a hybrid of Table/Array since the Ninox language won't let you create a multi-dimensional from scratch. A couple of other points...

 

1) You can delete a specific record based on the array's index.

2) You can create a record and as long as you reassign the table to the array variable it will be included in the array. Both of these mean you don't have to define the array size in advance.

3) You can use different data types in the array.

 

This is probably of limited interest, but the more you know ;)

Ninox Profile

@Mconneen, Have you noticed the array() function? It didn't register for me until yesterday. That function and the unique() function will combine 2 "multi-dimensional" arrays and you can access all the field values in the array.

 

Is this an example of what you are talking about?...

 

let arrObj := {
name: "Lisa",
children: [{
name: "Charlie"
}, {
name: "Sarah"
}]
};
item(arrObj.children, 1).name

 

That will return "Sarah"

Reply