How would I assign a dynamic array to a hash table?
For example,
//Dynamic Array
DIM VALUES$
VALUES$
VALUES$
//Hash Table
DIM NAMES$
NAMES$["Luke"] = VALUES$
I essentially want
Key "Luke" = [1,2]
Hello
You can't.
You can only assign a numeric or a string value to an associative array element
Basically, what you want is :
names$["Luke", 1] = "1"
names$["Luke", 2] = "2"
But such a syntax is invalid in PxPlus.
However if what you want is actually to convert the hash table to a JSON string, you can do it like this
->names$["Luke.1"]="1"
->names$["Luke.2"]="2"
->? dim(list edit names$)
{
"Luke":["1","2"]
}
->
Hope this helps