Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

76
Views
Process data contained in an object itself contained in a data table

I have a data table that retrieves arrays of data and I would like to be able to display them in the form of streaming data curves.

Here is a screen of my datatable :

photo of my datable

Here is the code that is supposed to process this data :

async getCanR(CanRArr) {
            return fetch('http://pathtomydatatable/', {
                    method: 'GET',
                    headers: {
                        'Content-Type': 'application/json',
                    },
                })
                .then(res => res.text())
                .then((result) => {
                    const data = JSON.parse(result);
                    let newData = [];
                    let element;
                    data.forEach(d => {
                        const {
                            can_r_led,
                        } = d;
                        console.log(d);

                        can_r_led.forEach(element =>
                            console.log(element),
                            console.log('element est un ' + typeof(element)),
                        ),

                        console.log('can-r-led est un ' + typeof(can_r_led));

                        newData.push({
                            x: Date.now(),
                            y: can_r_led[0].element,
                        });

                        console.log('new data = ')
                        console.log(newData);


                        CanRArr.push(newData);
                        return newData;
                        
                    }); 
                    
                })
                .catch((error) => {
                    console.log(error)
                });
        },

the first data.forEach loop goes through my data table and selects the last received row. The second loop can_r_led.forEach parses the objectc can_r_led .

Only, I have this error "Cannot read properties of undefined reading 'element'

'console.log(element)' working correctly.

I guess problem is on ligne 'y: can_r_led[0].element,'

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!