Dashboard 2.0 Table how to limit data

I am using the table and have been appending data to it. Is there a way to allow it to accumulate a specific number of rows and then replace older rows in a FIFO manner?

I can imagine implementing this by storing the data outside of the table and sending each update as a Replace instead of an Append action. My only problem with this approach is that if I want the limit to be something like a thousand rows and I have 10-15 updates per minute, that is a lot of traffic. Additionally, I am not sure what the user experience is if the user is on page 4 and the data gets replaced.

I am thinking that perhaps the solution is to just keep the data in my flow and have a user action trigger populating the data with a snapshot at the moment of trigger.

I do recognize that the Max Rows that superficially looks like this might address my requirement only speaks to the pagination and not the actual max rows to be stored.

10 days later, I see it has been seen 34 times, but no replies, thus I guess I will have to manage the number of items in the array manually.

I had raised the same issue before , but yes you have to manage yourself with a FIFO buffer before the table .. than replace all option in table ... otherwise you are out of memory soon :wink:

Is there a node that you used for the FIFO buffer or did you create your own Function node and the switch icon? I am not finding a node in a quick search.

I created my own FIFO node with support from community here .... the FIFO will handle msg.payload and treats it as object.. in my use-case I show a history of "Offline" device events and have added the msg.payload.timestamp for each message object.

The FIFO can be configured on how many Objects you want to store (20 by default). The FIFO stores them as an array of a clocal Flow-Variable

[
    {
        "id": "069fdecd535f40a9",
        "type": "subflow",
        "name": "FIFO (object)",
        "info": "# FIFO\n## First in First Out subflow\nThis flow receives a series of msg.payloads and builds a queue using FIFO (First in First out) method. The LIFO size is configurabe through subflow enviroment variables.\n\n### Input\n`msg.topic == put`\nWill add the `msg.payload` to the end of the array. Everytime a new item is received the second output sends the complete queue.\n\n`msg.topic == get`\nWill remove the first item of the stack and will send it in the first output\n\n`msg.topic == list`\nSends the complete list on the second output.\n\n### Output 1\nThe first item on the top of the stack. It is sent only when `msg.topic == get`.\n\n### Output 2\nThe complete queue in Array format. It is sent everytime a new item is added, removed or when `msg.topic == list`\n\n### Status\nAlways show the queue size.\n\n### Enviroment Variables\n`Buffer_Size` defines the size of the queue. If a new item arrives and the queue is full, the oldest item will be removed.",
        "category": "",
        "in": [
            {
                "x": 100,
                "y": 120,
                "wires": [
                    {
                        "id": "b81a11f776547198"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 1120,
                "y": 60,
                "wires": [
                    {
                        "id": "0dfe123bae3d971f",
                        "port": 0
                    }
                ]
            },
            {
                "x": 1120,
                "y": 100,
                "wires": [
                    {
                        "id": "6b258a3b2c3ebb9c",
                        "port": 0
                    }
                ]
            }
        ],
        "env": [
            {
                "name": "Buffer_Size",
                "type": "num",
                "value": "6"
            }
        ],
        "meta": {},
        "color": "#DDAA99",
        "icon": "font-awesome/fa-ellipsis-v",
        "status": {
            "x": 1120,
            "y": 140,
            "wires": [
                {
                    "id": "fe1d80d74279a747",
                    "port": 0
                },
                {
                    "id": "9c954bb2fdeb06b4",
                    "port": 0
                }
            ]
        }
    },
    {
        "id": "7880590df76f9ff6",
        "type": "switch",
        "z": "069fdecd535f40a9",
        "name": "Topic",
        "property": "topic",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "get",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "put",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "list",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "clear",
                "vt": "str"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 5,
        "x": 390,
        "y": 120,
        "wires": [
            [
                "4b83edbae5bc0152"
            ],
            [
                "be1f1850c37acf5f"
            ],
            [
                "6c3572fe40d33be6"
            ],
            [
                "e0cceea26f7697e5"
            ],
            []
        ]
    },
    {
        "id": "4b83edbae5bc0152",
        "type": "function",
        "z": "069fdecd535f40a9",
        "name": "get",
        "func": "let xxx = flow.get(\"queue\");\nvar item;\n\nif (!Array.isArray(xxx)){\n    //queue = [];\n    //queue.length=0;\n    xxx.splice(0, xxx.length);\n}else\n{\n    item = xxx.pop();\n}\n\n\nflow.set(\"queue\", xxx)\nmsg.payload = item;\n\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 550,
        "y": 60,
        "wires": [
            [
                "7bbf04dc8fcbf342"
            ]
        ]
    },
    {
        "id": "fe1d80d74279a747",
        "type": "change",
        "z": "069fdecd535f40a9",
        "name": "Count",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$count(msg.payload)\t",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 730,
        "y": 140,
        "wires": [
            []
        ]
    },
    {
        "id": "e0cceea26f7697e5",
        "type": "change",
        "z": "069fdecd535f40a9",
        "name": "",
        "rules": [
            {
                "t": "delete",
                "p": "queue",
                "pt": "flow"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "queue",
                "tot": "flow"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 580,
        "y": 180,
        "wires": [
            [
                "fe1d80d74279a747"
            ]
        ]
    },
    {
        "id": "6c3572fe40d33be6",
        "type": "change",
        "z": "069fdecd535f40a9",
        "name": "queue",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "queue",
                "tot": "flow"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 140,
        "wires": [
            [
                "fe1d80d74279a747",
                "3113b971abd47d00"
            ]
        ]
    },
    {
        "id": "be1f1850c37acf5f",
        "type": "function",
        "z": "069fdecd535f40a9",
        "name": "put",
        "func": "var queue = flow.get(\"queue\")\n\n\nif (!Array.isArray(queue)){\n    queue = [];\n}else if ( queue.length >= env.get(\"Buffer_Size\") ){\n    queue.pop(1);\n}\n\nqueue.unshift(msg.payload);\n\nflow.set(\"queue\", queue);\nmsg.payload = queue;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 550,
        "y": 100,
        "wires": [
            [
                "3113b971abd47d00"
            ]
        ]
    },
    {
        "id": "b81a11f776547198",
        "type": "json",
        "z": "069fdecd535f40a9",
        "name": "",
        "property": "payload",
        "action": "str",
        "pretty": false,
        "x": 230,
        "y": 120,
        "wires": [
            [
                "7880590df76f9ff6"
            ]
        ]
    },
    {
        "id": "5bcaba36a4caa805",
        "type": "split",
        "z": "069fdecd535f40a9",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 710,
        "y": 100,
        "wires": [
            [
                "d59d72db547ca45c"
            ]
        ]
    },
    {
        "id": "d59d72db547ca45c",
        "type": "json",
        "z": "069fdecd535f40a9",
        "name": "",
        "property": "payload",
        "action": "obj",
        "pretty": false,
        "x": 850,
        "y": 100,
        "wires": [
            [
                "6b258a3b2c3ebb9c"
            ]
        ]
    },
    {
        "id": "6b258a3b2c3ebb9c",
        "type": "join",
        "z": "069fdecd535f40a9",
        "name": "",
        "mode": "auto",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": "false",
        "timeout": "",
        "count": "",
        "reduceRight": false,
        "x": 990,
        "y": 100,
        "wires": [
            []
        ]
    },
    {
        "id": "7bbf04dc8fcbf342",
        "type": "split",
        "z": "069fdecd535f40a9",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 710,
        "y": 60,
        "wires": [
            [
                "c28a30133093b920"
            ]
        ]
    },
    {
        "id": "c28a30133093b920",
        "type": "json",
        "z": "069fdecd535f40a9",
        "name": "",
        "property": "payload",
        "action": "obj",
        "pretty": false,
        "x": 850,
        "y": 60,
        "wires": [
            [
                "0dfe123bae3d971f"
            ]
        ]
    },
    {
        "id": "0dfe123bae3d971f",
        "type": "join",
        "z": "069fdecd535f40a9",
        "name": "",
        "mode": "auto",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": "false",
        "timeout": "",
        "count": "",
        "reduceRight": false,
        "x": 990,
        "y": 60,
        "wires": [
            []
        ]
    },
    {
        "id": "9c954bb2fdeb06b4",
        "type": "catch",
        "z": "069fdecd535f40a9",
        "name": "",
        "scope": null,
        "uncaught": false,
        "x": 800,
        "y": 180,
        "wires": [
            []
        ]
    },
    {
        "id": "3113b971abd47d00",
        "type": "junction",
        "z": "069fdecd535f40a9",
        "x": 620,
        "y": 100,
        "wires": [
            [
                "5bcaba36a4caa805",
                "fe1d80d74279a747"
            ]
        ]
    },
    {
        "id": "930cdb15beb07106",
        "type": "moment",
        "z": "1b4901acc4991304",
        "g": "950ed30da8e3c242",
        "name": "",
        "topic": "",
        "input": "",
        "inputType": "date",
        "inTz": "Australia/Sydney",
        "adjAmount": 0,
        "adjType": "days",
        "adjDir": "add",
        "format": "YYYY/MM/DD  HH:mm:ss",
        "locale": "en-AU",
        "output": "payload.timestamp",
        "outputType": "msg",
        "outTz": "Australia/Sydney",
        "x": 540,
        "y": 320,
        "wires": [
            [
                "9aca17142d600f72"
            ]
        ]
    },
    {
        "id": "9aca17142d600f72",
        "type": "change",
        "z": "1b4901acc4991304",
        "g": "950ed30da8e3c242",
        "name": "put",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "put",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 710,
        "y": 320,
        "wires": [
            [
                "9312d56a835a4e4f"
            ]
        ]
    },
    {
        "id": "3f9b66fe86f043b6",
        "type": "inject",
        "z": "1b4901acc4991304",
        "g": "950ed30da8e3c242",
        "name": "",
        "props": [
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "clear",
        "x": 710,
        "y": 360,
        "wires": [
            [
                "9312d56a835a4e4f"
            ]
        ]
    },
    {
        "id": "c4be9b8d9c0b4ed8",
        "type": "inject",
        "z": "1b4901acc4991304",
        "g": "950ed30da8e3c242",
        "name": "",
        "props": [
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "list",
        "x": 710,
        "y": 400,
        "wires": [
            [
                "9312d56a835a4e4f"
            ]
        ]
    },
    {
        "id": "9312d56a835a4e4f",
        "type": "subflow:069fdecd535f40a9",
        "z": "1b4901acc4991304",
        "g": "950ed30da8e3c242",
        "name": "",
        "env": [
            {
                "name": "Buffer_Size",
                "value": "20",
                "type": "num"
            }
        ],
        "x": 870,
        "y": 320,
        "wires": [
            [],
            [
                "72f33793d4b1b2c4",
                "0c1175cc7e234777"
            ]
        ]
    },
    {
        "id": "0c1175cc7e234777",
        "type": "ui-table",
        "z": "1b4901acc4991304",
        "g": "950ed30da8e3c242",
        "group": "d7d93ed8bc83f115",
        "name": "History",
        "label": "Offline",
        "order": 1,
        "width": 0,
        "height": 0,
        "maxrows": "10",
        "passthru": false,
        "autocols": false,
        "showSearch": true,
        "selectionType": "click",
        "columns": [
            {
                "title": "Time",
                "key": "timestamp",
                "keyType": "key",
                "type": "text",
                "width": "",
                "align": "start"
            },
            {
                "title": "Topic",
                "key": "topic",
                "keyType": "key",
                "type": "text",
                "width": "20",
                "align": "center"
            }
        ],
        "mobileBreakpoint": "sm",
        "mobileBreakpointType": "defaults",
        "action": "replace",
        "x": 1020,
        "y": 320,
        "wires": [
            []
        ]
    },
    {
        "id": "d7d93ed8bc83f115",
        "type": "ui-group",
        "name": "Offline Devices",
        "page": "520f6c0b2e1e3ea3",
        "width": "4",
        "height": "1",
        "order": 5,
        "showTitle": true,
        "className": "",
        "visible": "true",
        "disabled": "false",
        "groupType": "default"
    },
    {
        "id": "520f6c0b2e1e3ea3",
        "type": "ui-page",
        "name": "Main !",
        "ui": "a0ddd2d7af1545fc",
        "path": "/Main",
        "icon": "home",
        "layout": "flex",
        "theme": "0d7c977402df5308",
        "order": 1,
        "className": "",
        "visible": true,
        "disabled": "false"
    },
    {
        "id": "a0ddd2d7af1545fc",
        "type": "ui-base",
        "name": "DB2",
        "path": "/dashboard",
        "includeClientData": true,
        "acceptsClientConfig": [
            "ui-notification",
            "ui-control"
        ],
        "showPathInSidebar": false,
        "navigationStyle": "default",
        "titleBarStyle": "default"
    },
    {
        "id": "0d7c977402df5308",
        "type": "ui-theme",
        "name": "Default Theme",
        "colors": {
            "surface": "#ffffff",
            "primary": "#808080",
            "bgPage": "#000000",
            "groupBg": "#b8b7b7",
            "groupOutline": "#616161"
        },
        "sizes": {
            "pagePadding": "12px",
            "groupGap": "12px",
            "groupBorderRadius": "4px",
            "widgetGap": "12px",
            "density": "default"
        }
    }
]`Preformatted text`