From JSON to Array - Forum

Forum Navigation
You need to log in to create posts and topics.

From JSON to Array

Hello.

I am trying to populate a dropdown withe the result of a select statement. I can display the JSON result without problems; However, when I try to displau the values only, I fail miserably....

Please help, here is the code I am using:

CreateEmptyObject [misku]
CreateEmptyArray [arreglo]

SetVar [misku] [respsku]

BeginJS

const jsonArray = JSON.parse($App.misku);

// Extracting values and storing them in a new array
jsonArray.forEach(item => {
valuesArray.push(item.NombreSKU);
});

$App.arreglo = [...valuesArray];

EndJS

 

The Jason is multiline with this format:

{"NombreSKU":"Acido 2-Etil Hexanoico "}

respsku is the parameter for the subroutine, the Json from the select is passed using it

@egodyla please check this thread with a very similar question and let me know if you have any doubts.
You will find a sample code and downloable sample app there.

https://visualneo.com/forum/topic/problem-with-reading-js

Regards.

Thank you Luis! It wouldn´t work because of repeated records. But your code is much more simpler.

Thanks again!