Hello,
I am trying to convert the selected items of my combo box into an array that can be put into a collection.
Here is what my JSON Object looks like:
ClearCollect(myCollection,
{
someKey: "someValue",
someArray: ["VALUE1", "VALUE2", "VALUE3"]
}
I want someArray to be populated with values from my combobox called aCombobox that gets its items from a dataverse table called "Status", and uses the values from the column 'cr0fa_status'.
Here's how I'm attempting to do this currently:
Set(myVar2, Concat(aCombobox.SelectedItems, Char(34) & 'Status (cr0fa_status)' & Char(34) & ","));
Set(trimmedStatuses, Left(myVar2, Len(myVar2)-1));
What this yields into trimmedStatuses is: "INREV","INPROG"
where inrev and inprog are statuses from the status table.
However, when I try to put this into a collection by doing:
ClearCollect(myCollection,
{
someKey: "someValue",
someArray: [trimmedStatuses]
}
and then converting that collection to JSON, I end up with this JSON structure:
{
"someKey": "someValue",
"someArray": [
{
"Value": "\"INREV\",\"INPROG\""
}
]
}
I do not want to have the "Value" key, and i just want it to be: "someArray": ["INREV","INPROG"]
So, my overall question is how do I convert the SelectedItems into a JSON array object so that it looks correct in my end JSON payload.
How do I