Displaying a list of Numbers from an array of objects

good day

I have the problem when outputting from a json The output payload looks like this:
"{{msg.payload.value[0].callerNumber}}"
This works fine so far. But I have a dynamic number as value. So not only 0 or 1 or 2 etc. but it is about a phone log history. I.e. I read the log from teams and there are more than only one number which should be read. This array also grows and I will still include that you can enter a date range, so there will be more output.
How can I include that all values of, in this example "Caller Number" are output in a list?

So there are no solution for this?

Of course there is always a solution however I personally skipped this one because I could not really see what you wanted?

You ask in the #general category (meaning its NOT a #dashboard thing) with a title "Number setting in json output" (which suggests you want to set values in some json) ask how you can get "Caller Number" output in a list (does that mean on a dashboard? in an array? in msg.payload only?)

Maybe if you showed sample data and explained exactly where and how you want it to appear?

I apologize for the late reply and putting the wrong forum group.

It looks like this:

I get the call logs via the MS api for teams

Reading a number works. But the JSON always contains more than one number because I want to read the history of a day and display it in a list.
grafik

So how can I display them in a list?

OK, now it makes more sense.

I have updated the category and the title to attract the kind of guys who can help with these type of questions.

If this were my dashboard, I would simply install node-red-node-ui-table and display the list in tabular format.

1 Like


grafik

Thanks for the tip with the ui table. I think this is exactly what I need. Only I still do not know how I can display all numbers (on this day there are 19 entries) Can unfortunately not include an array there instead of the number, otherwise I would have simply created an array from this number and this then included there.
So how can I have all the values (in this case 19 pieces) read out?
Thanks for your help

You get 1 entry because you set the payload to 1 entry of the array.

Try passing the FULL array to payload...

msg.payload = msg.payload.value
return msg

If necessary, you could filter out the extra properties in the array entries using map e.g...

msg.payload = msg.payload.value.map(e => {
  return { 
    callerNumber: e.callerNumber 
  }
})
return msg
1 Like

Ah i understand. Thank you for your great help.
Now it works realy good

1 Like

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