chart - updating data with an array issue

Moderator: Support

dphoeck@gmail.com
Posts: 11
Joined: Sun Mar 21, 2021 11:21 pm

Re: chart - updating data with an array issue

Post by dphoeck@gmail.com »

Hi Serhii,

I tried every way to make this work, but it didn't work with that TS code.

I tried adding the TS code here (in the success mapping), but that didn't work:

mapping with JSON.PNG
mapping with JSON.PNG (40.89 KiB) Viewed 699 times

Then I tried mapping the API response key value directly to the "data" variable, but that didn't work either:

chart data from data variable.PNG
chart data from data variable.PNG (9.04 KiB) Viewed 699 times
mapping to data variable.PNG
mapping to data variable.PNG (31.45 KiB) Viewed 699 times

I tried mapping to the "data" variable with and without the TS code, but neither worked.

What am I doing wrong?

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

Re: chart - updating data with an array issue

Post by Serhii Kulibaba »

Hello,

Please add the alert on that mapping. Do you see the value from that mapping there?

I suggest you use a plain TS code to get this value, not a mapping.

  1. Just read the full response and print it to the label/alert.
  2. If you see it there - add the child property to the label/alert to read only that child property
  3. Repeat #2 while you don't get the exact value
dphoeck@gmail.com
Posts: 11
Joined: Sun Mar 21, 2021 11:21 pm

Re: chart - updating data with an array issue

Post by dphoeck@gmail.com »

Hi,

When I map the child property directly to the text label it works fine. This is what happens when I invoke the service on the button click and map the response's child property to the text label:

child to label.PNG
child to label.PNG (8.96 KiB) Viewed 620 times

It looks like the response is fine, the problem is, when I apply this same mapping directly to the chart, it doesn't work.

I'm not sure how map this to the label with TS, much less how to directly do this to set the data variable, so I will need to figure that out. I tried doing a success event after invoking the service of TS of "this.data = JSON.parse(res.feed.entry[0].content.$t);" but that didn't work.

Post Reply