I need a global array with two dimensions and different datatypes in the 2nd dimension as global variable:
Int| Strng | Int | Boolean
ID | Name | Age | Customer
1 | "Joe" | 12 | T
2 | "Eli" | 15 | F
Globals can be declared as “Method” -> “Property” and if the name ends with “()”, it’s an array of the properties type. Right?
I need direct access to the different rows/columns/cells. A part of the table is the data basis of a list box and another part will be synchronised with a SQLite DB.
How can I implement my example?
Is there a better data type to store the table shown above?
PS: I know how to use globals. In this case, I absolutely need that.
Sounds like a good use for an in-memory database. If you want to stick with arrays with different types you can declare them as variant or auto.
There is no way to define an array with multiple types in a single array
There are less that ideal ways to fake this - but I wouldn’t
Your needs for actually searching the data would drive whether I’d use #1 or #2
- create a class that will hold the data in each row
id as integer
name as string
age as integer
customer as boolean
Then declare a global array of type person
- use a in memory sqlite database
I would not use variants or autos since you can put anything in a variant so you have no type safety whatsoever
be aware that techincally with option #2 (SQlite) you have no type safety either… but it is easier to deal with than Variant/Auto
but if the number of items in the “array” exceed a few dozen, then using Sqlite (or another database engine) should be you only course of action