JSON data into table issue

Hi all,

Im completely stumped can somebody give me some guidence.

im trying to put data into a ui_table and so far I have got it working....... for 1 record

the flow is really simple

The only thing method I can think to do it is to repeat on function 86 (above picture) depending how many records (global.counter) are returned... to get the value on the repeats I have tried to use

msg.payload.jobs.job[{{global.counter}}].id[0]._

that didnt work.

Im not sure if this is the only method or just a mess way to do it??

any help appreciate.. its doing my head in!

Have you looked at the example in
import > examples > ui-table.

Also have you search the forum for examples (updating ui-table)

Or are you trying to create a array of objects to send to table, as your post is not clear.

Moved into the Dashboard category.

Thanks for the Reply.

Im trying to create an array of objects to send to the table

I can get the first line to populate.. however there are 50 more records

However there are 50 more records

image

Hope that makes sense.

I remember helping you before Christmas and asking for clear data, It is hard to suggest solutions with out it, and images are not great.
In future supply all code and data in text format, and surrounded by triple backticks.

You need to create a loop and add each object you create in the loop to an output array.
Something like this,( not complete as You never supplied your code in a copyable format or the data )

const output = []
msg.payload.jobs.job.forEach(obj => {
    output.push(
        {
            rego :obj.sections[0].secti,
            id: obj.id[0]._
        }
    )
})
msg.payload = output
return msg;

Once again.. Thank you so much!.. that works perfectly

Sorry about not being able to provide full data.. some of it is sensitive

Then you edit it to remove sensitive items, also the full 50 would not be required, just 2 or 3 array objects is enough to see the data structure.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.