@cbp posted a new topic, subject "Monitor variables in a table". It read:

   I'm an embedded programmer and work extensively on the STM32 MCUs. They have a tool called Cubemonitor for live monitoring variables within the executable and is based on Node-red. I'm trying to figure out how to monitor arrays and variables from my program in a tabular format. They do have a chart-based output and that works, however, for a large # of variables the chart is very clunky and any data is barely legible. A tabular format would be far more readable.
    
    Please note that I have zero experience with javascript and nodered and I'm hoping someone here can help me since I'm not getting anywhere on the ST community site.
    
    The first image is what the variables window looks like. This is the list of variables that I need to monitor. The second image is that of the table but I have no clue as to how to add these variables to this table.
    
    1866×1090 364 KB
    
    1866×1090 336 KB

To which @TotallyInformation (Julian Knight) replied

    First thing to do is to see what output that first node gives you. Add a debug node to its output and see what it produces. I would guess that it is either an JavaScript object or an array.. Based on that, we can work out how to feed it into the ui table node.

After which, @cbp added

    Ok I added that and this is what it seems to produce on node status(?)
    
    1403×832 220 KB
    
    1403×832 214 KB

To which @TotallyInformation (Julian Knight) replied

    OK, so each variable produces a separate msg. What is not clear to me is what x and y mean and why there are 2 sets of values for each output?
    
    Next step would be to simplify that output. Ultimately, what you are looking to end up with is a msg.payload that contains an ARRAY of OBJECTS. Where each object represents a row in your table and the object's properties are the column names:
    [code] 
        [
           {
              "col1": val1, 
              "col2": val2,
              ...
           },
           ... next row ...
        ]
        
    [/code]
    
    So first you want each of those output messages to have a payload that looks like the row data. Then you need to either join all of the "rows" together with a join node or pass the object to the front-end and do the work there.
    
    Though I suppose you might be looking to have the variables as the columns? In that case, you would need to work out the right format for the data along the same principles.

@cbp replied

    TotallyInformation:
    
    > What is not clear to me is what x and y mean and why there are 2 sets of values for each output?
    
    Yep, that is not clear to me as well. For instance, `M2.runstate` is either `0` or `1`.
    
    TotallyInformation:
    
    > Then you need to either join all of the "rows" together with a join node or pass the object to the front-end and do the work there.
    
    I believe there is some post-processing allowable inside the nodes. Let me tinker with that a little more.
    
    TotallyInformation:
    
    > Though I suppose you might be looking to have the variables as the columns?
    
    No, I'd prefer them to be in rows and there should be a single column to show values.
    
    Even if I do figure out how to join all the rows, I'm still not seeing the right values here.

Then @system (system) said

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


{'source': 'discourse', 'url': 'https://discourse.nodered.org/t/monitor-variables-in-a-table/42304', 'title': 'Monitor variables in a table', 'views': 445, 'has_accepted_answer': False, 'word_count': 584, 'like_count': 0, 'reply_count': 3, 'participant_count': 2, 'posts': 6, 'tags': '', 'author': '@cbp', 'participants': '@cbp, @TotallyInformation (Julian Knight), @system (system)', 'image_url': ['https://global.discourse-cdn.com/business6/uploads/nodered/optimized/3X/3/f/3f6fdd0d5c573450a1b457adc2f5e1c9a5b36a8a_2_1024x598.png'], 'created_at': '2021-03-09T05:10:03.404Z', 'last_posted_at': '2021-05-09T16:32:39.325Z'}