Filtering Trafic Information

Hi all,

I created a flow to extract trafic information from an rss-feed (still learning!). Next, I devised a rather complicated way to filter out trafic information relating to certain roads only. Even though I am a complete noob at this, I just know that there must be an easier way. Can someone please explain a simpler way to do this so that I can learn by example? Also, my solution is flawed in the sense that it does not take into account that sometimes multiple incidents may occur on the same road. It will only show one incident. Does anyone know a solution for this? Please find my flow below.

[{"id":"64c54d74.640334","type":"tab","label":"Example","disabled":false,"info":""},{"id":"4e36ae.ee4f3954","type":"http request","z":"64c54d74.640334","name":"https://www.verkeerplaza.nl/rssfeed","method":"GET","ret":"txt","paytoqs":false,"url":"https://www.verkeerplaza.nl/rssfeed","tls":"","persist":false,"proxy":"","authType":"","x":320,"y":120,"wires":[["9618661f.d56258"]]},{"id":"99e3a123.0acc7","type":"debug","z":"64c54d74.640334","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":60,"wires":[]},{"id":"9618661f.d56258","type":"xml","z":"64c54d74.640334","name":"","property":"payload","attr":"","chr":"","x":530,"y":120,"wires":[["99e3a123.0acc7","1f305022.77f13","5b0a48b1.450118","abf89e2b.c2dc9","ecc02038.785dc","4e8d730c.56bf2c","65110618.a29188","3cfd462f.85508a","7465405b.9df3e","fb2ac967.6aabb8","b68f909.430657","ab4c98b6.725558","90e2a461.fc4918","f612399b.821f38","e867cb1d.466378","3422d855.7a28c8","14cfbf92.00b62","5604caee.7d75e4"]]},{"id":"1f305022.77f13","type":"function","z":"64c54d74.640334","name":"Last 10 items","func":"msg.payload.oneA = msg.payload.rss.channel[0].item[0].title[0]\nmsg.payload.oneB = msg.payload.rss.channel[0].item[0].description[0]\n\nmsg.payload.twoA = msg.payload.rss.channel[0].item[1].title[0]\nmsg.payload.twoB = msg.payload.rss.channel[0].item[1].description[0]\n\nmsg.payload.threeA = msg.payload.rss.channel[0].item[2].title[0]\nmsg.payload.threeB = msg.payload.rss.channel[0].item[2].description[0]\n\nmsg.payload.fourA = msg.payload.rss.channel[0].item[3].title[0]\nmsg.payload.fourB = msg.payload.rss.channel[0].item[3].description[0]\n\nmsg.payload.fiveA = msg.payload.rss.channel[0].item[4].title[0]\nmsg.payload.fiveB = msg.payload.rss.channel[0].item[4].description[0]\n\nmsg.payload.sixA = msg.payload.rss.channel[0].item[5].title[0]\nmsg.payload.sixB = msg.payload.rss.channel[0].item[5].description[0]\n\nmsg.payload.sevenA = msg.payload.rss.channel[0].item[6].title[0]\nmsg.payload.sevenB = msg.payload.rss.channel[0].item[6].description[0]\n\nmsg.payload.eightA = msg.payload.rss.channel[0].item[7].title[0]\nmsg.payload.eightB = msg.payload.rss.channel[0].item[7].description[0]\n\nmsg.payload.nineA = msg.payload.rss.channel[0].item[8].title[0]\nmsg.payload.nineB = msg.payload.rss.channel[0].item[8].description[0]\n\nmsg.payload.tenA = msg.payload.rss.channel[0].item[9].title[0]\nmsg.payload.tenB = msg.payload.rss.channel[0].item[9].description[0]\n\nreturn msg;","outputs":1,"noerr":0,"x":670,"y":120,"wires":[["aed3fe50.4845c"]]},{"id":"aed3fe50.4845c","type":"template","z":"64c54d74.640334","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<TABLE ID =\"Verkeersinformatie\" border=\"0\" style=\"width:100%\">\n\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.oneA}}</TD>\n</TR>\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.oneB}}<HR></TD>\n</TR>\n\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.twoA}}</TD>\n</TR>\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.twoB}}<HR></TD>\n</TR>\n\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.threeA}}</TD>\n</TR>\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.threeB}}<HR></TD>\n</TR>\n\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.fourA}}</TD>\n</TR>\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.fourB}}<HR></TD>\n</TR>\n\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.fiveA}}</TD>\n</TR>\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.fiveB}}<HR></TD>\n</TR>\n\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.sixA}}</TD>\n</TR>\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.sixB}}<HR></TD>\n</TR>\n\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.sevenA}}</TD>\n</TR>\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.sevenB}}<HR></TD>\n</TR>\n\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.eightA}}</TD>\n</TR>\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.eightB}}<HR></TD>\n</TR>\n\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.nineA}}</TD>\n</TR>\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.nineB}}<HR></TD>\n</TR>\n\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.tenA}}</TD>\n</TR>\n<TR>\n    <TD style=\"width:100%\" align=\"left\">{{payload.tenB}}<HR></TD>\n</TR>\n\n\n</table>","output":"str","x":820,"y":120,"wires":[["9998b851.5d0508"]]},{"id":"9998b851.5d0508","type":"ui_template","z":"64c54d74.640334","group":"eb031d0a.78587","name":"Verkeer","order":1,"width":8,"height":17,"format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":960,"y":120,"wires":[[]]},{"id":"e61fafa2.c3c4c","type":"debug","z":"64c54d74.640334","name":"A4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1370,"y":420,"wires":[]},{"id":"e545e335.a0509","type":"debug","z":"64c54d74.640334","name":"A13","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1370,"y":460,"wires":[]},{"id":"5b0a48b1.450118","type":"change","z":"64c54d74.640334","name":"1","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[1].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":280,"wires":[["279f90c2.267b5"]]},{"id":"abf89e2b.c2dc9","type":"change","z":"64c54d74.640334","name":"2","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[2].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":320,"wires":[["279f90c2.267b5"]]},{"id":"ecc02038.785dc","type":"change","z":"64c54d74.640334","name":"3","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[3].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":360,"wires":[["279f90c2.267b5"]]},{"id":"279f90c2.267b5","type":"switch","z":"64c54d74.640334","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"A4","vt":"str"},{"t":"cont","v":"A13","vt":"str"},{"t":"cont","v":"A15","vt":"str"},{"t":"cont","v":"A16","vt":"str"},{"t":"cont","v":"A20","vt":"str"},{"t":"cont","v":"A50","vt":"str"},{"t":"cont","v":"A73","vt":"str"}],"checkall":"true","repair":false,"outputs":7,"x":890,"y":520,"wires":[["3d9030bf.2650a"],["ffcc4f2c.462e6"],["90aa3aa6.5b9e08"],["a3ea1b99.74c8e8"],["825a2b62.b1cd78"],["cbcbefd5.2bd3b"],["a2f5288.73363d8"]]},{"id":"4e8d730c.56bf2c","type":"change","z":"64c54d74.640334","name":"0","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[0].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":240,"wires":[["279f90c2.267b5"]]},{"id":"65110618.a29188","type":"change","z":"64c54d74.640334","name":"4","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[4].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":400,"wires":[["279f90c2.267b5"]]},{"id":"3cfd462f.85508a","type":"change","z":"64c54d74.640334","name":"5","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[5].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":440,"wires":[["279f90c2.267b5"]]},{"id":"7465405b.9df3e","type":"change","z":"64c54d74.640334","name":"6","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[6].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":480,"wires":[["279f90c2.267b5"]]},{"id":"fb2ac967.6aabb8","type":"change","z":"64c54d74.640334","name":"7","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[7].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":520,"wires":[["279f90c2.267b5"]]},{"id":"b68f909.430657","type":"change","z":"64c54d74.640334","name":"8","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[8].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":560,"wires":[["279f90c2.267b5"]]},{"id":"ab4c98b6.725558","type":"change","z":"64c54d74.640334","name":"9","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[9].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":600,"wires":[["279f90c2.267b5"]]},{"id":"90e2a461.fc4918","type":"change","z":"64c54d74.640334","name":"10","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[10].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":640,"wires":[["279f90c2.267b5"]]},{"id":"f612399b.821f38","type":"change","z":"64c54d74.640334","name":"11","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[11].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":680,"wires":[["279f90c2.267b5"]]},{"id":"e867cb1d.466378","type":"change","z":"64c54d74.640334","name":"12","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[12].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":720,"wires":[["279f90c2.267b5"]]},{"id":"3422d855.7a28c8","type":"change","z":"64c54d74.640334","name":"13","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[13].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":760,"wires":[["279f90c2.267b5"]]},{"id":"14cfbf92.00b62","type":"change","z":"64c54d74.640334","name":"14","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[14].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":800,"wires":[["279f90c2.267b5"]]},{"id":"5604caee.7d75e4","type":"change","z":"64c54d74.640334","name":"15","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item[15].title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":840,"wires":[["279f90c2.267b5"]]},{"id":"a1b831c7.45136","type":"debug","z":"64c54d74.640334","name":"A15","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1370,"y":500,"wires":[]},{"id":"6ed0a933.698328","type":"debug","z":"64c54d74.640334","name":"A16","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1370,"y":540,"wires":[]},{"id":"9df870a5.83278","type":"debug","z":"64c54d74.640334","name":"A20","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1370,"y":580,"wires":[]},{"id":"79728115.3acfe","type":"debug","z":"64c54d74.640334","name":"A50","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1370,"y":620,"wires":[]},{"id":"36df47a5.74a948","type":"debug","z":"64c54d74.640334","name":"A73","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1370,"y":660,"wires":[]},{"id":"547eb638.522ff8","type":"join","z":"64c54d74.640334","name":"Build Object with msg payload as key","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"1","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1430,"y":700,"wires":[["dbabe234.c2d34"]]},{"id":"3d9030bf.2650a","type":"change","z":"64c54d74.640334","name":"Change msg.topic A4","rules":[{"t":"set","p":"topic","pt":"msg","to":"A4","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":420,"wires":[["e61fafa2.c3c4c","547eb638.522ff8"]]},{"id":"ffcc4f2c.462e6","type":"change","z":"64c54d74.640334","name":"Change msg.topic A13","rules":[{"t":"set","p":"topic","pt":"msg","to":"A13","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":460,"wires":[["e545e335.a0509","547eb638.522ff8"]]},{"id":"90aa3aa6.5b9e08","type":"change","z":"64c54d74.640334","name":"Change msg.topic A15","rules":[{"t":"set","p":"topic","pt":"msg","to":"A15","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":500,"wires":[["a1b831c7.45136","547eb638.522ff8"]]},{"id":"a3ea1b99.74c8e8","type":"change","z":"64c54d74.640334","name":"Change msg.topic A16","rules":[{"t":"set","p":"topic","pt":"msg","to":"A16","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":540,"wires":[["6ed0a933.698328","547eb638.522ff8"]]},{"id":"825a2b62.b1cd78","type":"change","z":"64c54d74.640334","name":"Change msg.topic A20","rules":[{"t":"set","p":"topic","pt":"msg","to":"A20","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":580,"wires":[["9df870a5.83278","547eb638.522ff8"]]},{"id":"cbcbefd5.2bd3b","type":"change","z":"64c54d74.640334","name":"Change msg.topic A50","rules":[{"t":"set","p":"topic","pt":"msg","to":"A50","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":620,"wires":[["79728115.3acfe","547eb638.522ff8"]]},{"id":"a2f5288.73363d8","type":"change","z":"64c54d74.640334","name":"Change msg.topic A73","rules":[{"t":"set","p":"topic","pt":"msg","to":"A73","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":660,"wires":[["36df47a5.74a948","547eb638.522ff8"]]},{"id":"dbabe234.c2d34","type":"function","z":"64c54d74.640334","name":"Build Array for Table","func":"var arr = [\n    {\"Weg\": \"A4\", \"Melding\": msg.payload.A4},\n    {\"Weg\": \"A15\", \"Melding\": msg.payload.A15},\n    {\"Weg\": \"A16\", \"Melding\": msg.payload.A16},\n    {\"Weg\": \"A20\", \"Melding\": msg.payload.A20},\n    {\"Weg\": \"A50\", \"Melding\": msg.payload.A50},\n    {\"Weg\": \"A73\", \"Melding\": msg.payload.A73},\n];\nmsg.payload = arr;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1700,"y":700,"wires":[["93e13885.37e048"]]},{"id":"93e13885.37e048","type":"ui_table","z":"64c54d74.640334","group":"eb031d0a.78587","name":"Table dynamisch","order":2,"width":"20","height":"7","columns":[{"field":"Weg","title":"Weg","width":"10%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"Melding","title":"Melding","width":"90%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":1,"cts":true,"x":1910,"y":700,"wires":[[]],"info":"<style>\n    .tabulator-header {\n        display: none;\n    }\n</style>"},{"id":"37e8395a.016586","type":"inject","z":"64c54d74.640334","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":120,"wires":[["4e36ae.ee4f3954"]]},{"id":"49225c73.f2ef84","type":"comment","z":"64c54d74.640334","name":"Is there a way to simplify this step and the following two steps??","info":"","x":890,"y":200,"wires":[]},{"id":"79968ac8.19f9e4","type":"comment","z":"64c54d74.640334","name":"Sometimes, there are two messages (incidents) for the same road. How can I filter out and include both messages in the table?","info":"","x":1420,"y":380,"wires":[]},{"id":"eb031d0a.78587","type":"ui_group","z":"","name":"Trafic","tab":"8fb10066.70668","order":1,"disp":true,"width":"20","collapse":false},{"id":"8fb10066.70668","type":"ui_tab","z":"","name":"Example 2","icon":"dashboard","order":19,"disabled":false,"hidden":false}]

The best way to simplify something that is taking up a lot of nodes is often to work out how to do it in code and then use a function node.

In your case, you can loop around payload.rss.channel[0].item to walk through each entry. Something like:

payload.rss.channel[0].item.forEach( item => {
    switch (item.title) {
        case 'A4': {
            ....
            break;
        }
        ...
    }
})
[{"id":"8fd4c95e.e18128","type":"inject","z":"d8ad9a4a.cbd158","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":175,"y":1000,"wires":[["4bd0defe.04d13"]],"l":false},{"id":"4bd0defe.04d13","type":"http request","z":"d8ad9a4a.cbd158","name":"GET feed","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://www.verkeerplaza.nl/rssfeed","tls":"","persist":false,"proxy":"","authType":"","x":280,"y":1000,"wires":[["775b3967.473e68"]]},{"id":"775b3967.473e68","type":"xml","z":"d8ad9a4a.cbd158","name":"","property":"payload","attr":"","chr":"","x":375,"y":1000,"wires":[["591d2faf.b8485","dc8973c0.288a9"]],"l":false},{"id":"dc8973c0.288a9","type":"function","z":"d8ad9a4a.cbd158","name":"Filter","func":"\nmsg.payload.rss.channel[0].item.forEach( item => {\n    //node.warn(item)\n    const splitTitle = item.title[0].split(' ')\n    switch (splitTitle[0]) {\n        case 'A4': \n        case 'A13': \n        case 'A15': \n        case 'A16': \n        case 'A20': \n        case 'A50': \n        case 'A73': \n            node.send({topic: splitTitle[0], payload: item.title[0]})\n            break;\n    }\n})","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":1000,"wires":[["521ca9f4.4b5068"]]},{"id":"521ca9f4.4b5068","type":"debug","z":"d8ad9a4a.cbd158","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":1000,"wires":[]},{"id":"591d2faf.b8485","type":"debug","z":"d8ad9a4a.cbd158","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":510,"y":960,"wires":[]}]

1 Like

Thanks! That is awesome. So much more efficient. I am going to study this piece of code though to be able to comprehend it. If I may, one more question: how can I get multiple payloads relating to the same road as separate items in my table?

Well that code will send a new msg for each entry that is on one of the roads you are interested in.

If you want to update your table, you would do something like this (untested):

const out = []

msg.payload.rss.channel[0].item.forEach( item => {
    //node.warn(item)
    const splitTitle = item.title[0].split(' ')
    switch (splitTitle[0]) {
        case 'A4': 
        case 'A13': 
        case 'A15': 
        case 'A16': 
        case 'A20': 
        case 'A50': 
        case 'A73': 
            //node.send({topic: splitTitle[0], payload: item.title[0]})
            out.push({Weg: splitTitle[0], Melding: item.title[0]})
            break;
    }
})

return {topic:'Roads Table', payload: out}

That gives you a single msg with a payload property that is an array of objects which should translate well into a Dashboard table.

Updated version:

[{"id":"8fd4c95e.e18128","type":"inject","z":"d8ad9a4a.cbd158","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":95,"y":400,"wires":[["4bd0defe.04d13"]],"l":false},{"id":"4bd0defe.04d13","type":"http request","z":"d8ad9a4a.cbd158","name":"GET feed","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://www.verkeerplaza.nl/rssfeed","tls":"","persist":false,"proxy":"","authType":"","x":200,"y":400,"wires":[["775b3967.473e68"]]},{"id":"775b3967.473e68","type":"xml","z":"d8ad9a4a.cbd158","name":"","property":"payload","attr":"","chr":"","x":295,"y":400,"wires":[["591d2faf.b8485","dc8973c0.288a9"]],"l":false},{"id":"dc8973c0.288a9","type":"function","z":"d8ad9a4a.cbd158","name":"Filter","func":"const out = []\n\nmsg.payload.rss.channel[0].item.forEach( item => {\n    //node.warn(item)\n    const splitTitle = item.title[0].split(' ')\n    switch (splitTitle[0]) {\n        case 'A4': \n        case 'A13': \n        case 'A15': \n        case 'A16': \n        case 'A20': \n        case 'A50': \n        case 'A73':\n            node.warn(item)\n            //node.send({topic: splitTitle[0], payload: item.title[0]})\n            out.push({road: splitTitle[0], incident: item.title[0]})\n            break;\n    }\n})\n\nreturn {topic:'Roads Table', payload: out}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":430,"y":400,"wires":[["521ca9f4.4b5068","e043ae1f.81b8e"]]},{"id":"521ca9f4.4b5068","type":"debug","z":"d8ad9a4a.cbd158","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":610,"y":360,"wires":[]},{"id":"591d2faf.b8485","type":"debug","z":"d8ad9a4a.cbd158","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":430,"y":360,"wires":[]},{"id":"e043ae1f.81b8e","type":"ui_table","z":"d8ad9a4a.cbd158","group":"60c4409f.46252","name":"Table dynamisch","order":2,"width":"20","height":"7","columns":[{"field":"road","title":"Weg","width":"10%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"incident","title":"Melding","width":"90%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":630,"y":420,"wires":[],"info":"<style>\n    .tabulator-header {\n        display: none;\n    }\n</style>"},{"id":"76a0f30c.6a4fac","type":"inject","z":"d8ad9a4a.cbd158","name":"Clear the table","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[]","payloadType":"json","x":400,"y":460,"wires":[["e043ae1f.81b8e"]]},{"id":"60c4409f.46252","type":"ui_group","z":"","name":"Trafic","tab":"354dbb1b.132e04","order":1,"disp":true,"width":"20","collapse":false},{"id":"354dbb1b.132e04","type":"ui_tab","z":"","name":"Example 2","icon":"dashboard","order":19,"disabled":false,"hidden":false}]

Awesome! Thanks again for helping me out! Much appreciated!

1 Like

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