01-23-2018 02:37 - edited 01-23-2018 06:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-23-2018 02:37 - edited 01-23-2018 06:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello, i have a probably very simple problem. I just want to select a specific value from a array:
Settings:
<Select label={`Battery`} settingsKey="battery" options={[ {name:"pos01"}, {name:"pos02"}, {name:"pos03"} ]} />
In app:
if (evt.data.key === "battery" && evt.data.newValue) { let myBatteryPos = util.stripQuotes(evt.data.newValue); console.log(myBatteryPos); }
console:
{selected:[0],values:[{name:pos01}]}
But i need only the value:
pos01
or pos2 or pos3
can someone help me. Many Thanks
Answered! Go to the Best Answer.

Accepted Solutions
01-31-2018 02:30
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-31-2018 02:30
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Old:
let myBatteryPos = util.stripQuotes(evt.data.newValue);
New:
let myBatteryPos = JSON.parse(evt.data.newValue).values[0].name;
is working.
01-31-2018 02:30
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-31-2018 02:30
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Old:
let myBatteryPos = util.stripQuotes(evt.data.newValue);
New:
let myBatteryPos = JSON.parse(evt.data.newValue).values[0].name;
is working.
