Hello,
I'm trying to create a table with column names specified in a variable.
I read that I can create a JSON object and use the variable as one of the property names, which I completed like so:
Set (jsnString, "{""items"":{""properties"":{" &
Concat(colTest,""" & Text(Value) & """: {""type"": ""string""},") &
"},""required"": [],""type"":""object""},""type"":""array""}");
Set(jsnString2, Substitute(jsnString,"},}","}}"));
Where colTest contains a table with 1 column and each record contains the column names I want.
The resulting string is:
"{\"items\":{\"properties\":{\"Column 1\":{\"type\":\"string\"},{\"Column 2\": {\"type\": \"string\"},{\"Column 3\": {\"type\": \"string\"},{\"Column 4\": {\"type\": \"string\"}},\"required\": [],\"type\":\"object\"},\"type\":\"array\"}"
The problem comes when Parse this and try to wrap it in a Table:
Set(myJSONObject, ParseJSON(jsnString2));
ClearCollect(coljson,Table(myJSONObject));
It throws an error and wants a Table whereas I am passing an object.
Any ideas on how to convert this object to a table?
Thank you!