UNPKG

node-red-contrib-alasql

Version:

Node-RED wrapper for AlaSQL database and XLSX import/export

1 lines 26.1 kB
[{"id":"ac461d84.e7abc","type":"tab","label":"AlaSQL File In/Out"},{"id":"ab9e1f5f.8ee36","type":"tab","label":"Alasql"},{"id":"a62b2385.ba7c8","type":"tab","label":"Sandbox"},{"id":"d772419e.8363c","type":"function","z":"a62b2385.ba7c8","name":"Transform","func":"msg.payload = '<html><head></head><body><h2>Hi world from function</h2></body></html>';\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":160,"wires":[[]]},{"id":"1dd88a4f.df1c96","type":"http response","z":"a62b2385.ba7c8","name":"","x":550,"y":100,"wires":[]},{"id":"31f66d1b.376e42","type":"http in","z":"a62b2385.ba7c8","name":"hi","url":"/hi","method":"get","swaggerDoc":"","x":210,"y":100,"wires":[["7304d742.303cf8"]]},{"id":"9bf52483.3fdc18","type":"inject","z":"a62b2385.ba7c8","name":"High","topic":"","payload":"high","payloadType":"str","repeat":"","crontab":"","once":false,"x":170,"y":280,"wires":[["8ab0a9be.0038b8"]]},{"id":"8ab0a9be.0038b8","type":"function","z":"a62b2385.ba7c8","name":"Route Signal","func":"var signal = msg.payload;\nif (signal === 'high') return [msg,null,null];\nelse if (signal === 'medium') return [null,msg,null];\nelse if (signal === 'low') return [null,null,msg];\n","outputs":"3","noerr":0,"x":370,"y":320,"wires":[["26c994dc.2ffeec"],["8dfee326.e8ee8"],["3049ac5a.f5cc34"]]},{"id":"26c994dc.2ffeec","type":"debug","z":"a62b2385.ba7c8","name":"","active":true,"console":"false","complete":"payload","x":570,"y":280,"wires":[]},{"id":"8dfee326.e8ee8","type":"debug","z":"a62b2385.ba7c8","name":"","active":true,"console":"false","complete":"false","x":570,"y":320,"wires":[]},{"id":"3049ac5a.f5cc34","type":"debug","z":"a62b2385.ba7c8","name":"","active":true,"console":"false","complete":"false","x":570,"y":360,"wires":[]},{"id":"5e31d5c9.43712c","type":"inject","z":"a62b2385.ba7c8","name":"Medium","topic":"","payload":"medium","payloadType":"str","repeat":"","crontab":"","once":false,"x":160,"y":320,"wires":[["8ab0a9be.0038b8"]]},{"id":"2e8b4606.b76c9a","type":"inject","z":"a62b2385.ba7c8","name":"Low","topic":"","payload":"low","payloadType":"str","repeat":"","crontab":"","once":false,"x":170,"y":360,"wires":[["8ab0a9be.0038b8"]]},{"id":"39da27df.7e9728","type":"file","z":"a62b2385.ba7c8","name":"File out","filename":"","appendNewline":false,"createDir":false,"overwriteFile":"true","x":700,"y":500,"wires":[]},{"id":"686fd9b.04c9c28","type":"comment","z":"a62b2385.ba7c8","name":"Request 'Hi' message","info":"### Hi - Html Message\n\nGoing to [hi](/hi) will display Hi!","x":380,"y":60,"wires":[]},{"id":"7304d742.303cf8","type":"template","z":"a62b2385.ba7c8","name":"Hi world","field":"payload","fieldType":"msg","format":"html","syntax":"plain","template":"<!DOCTYPE HTML>\n<html lang='en'>\n <head>\n <meta charset=\"utf-8\" />\n </head>\n <body>\n <h2>Hi world</h2>\n </body>\n</html>","x":380,"y":100,"wires":[["1dd88a4f.df1c96"]]},{"id":"d4de2d6d.d5694","type":"http request","z":"a62b2385.ba7c8","name":"Web Seinfeld","method":"GET","ret":"obj","url":"http://mysafeinfo.com/api/data?list=seinfeldepisodes&format=json","tls":"","x":240,"y":500,"wires":[["33334ede.df8532"]]},{"id":"ef992323.ffc88","type":"inject","z":"a62b2385.ba7c8","name":"Click Me","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":80,"y":500,"wires":[["d4de2d6d.d5694"]]},{"id":"ce7e7693.dbb5a8","type":"csv","z":"a62b2385.ba7c8","name":"","sep":",","hdrin":"","hdrout":true,"multi":"one","ret":"\\r\\n","temp":"seq,ss,ep,nm,dte","x":570,"y":500,"wires":[["39da27df.7e9728"]]},{"id":"33334ede.df8532","type":"function","z":"a62b2385.ba7c8","name":"Direct payload","func":"msg.filename = 'C:/Users/kim/Documents/seinfeld_from_web.csv';\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":500,"wires":[["ce7e7693.dbb5a8"]]},{"id":"b2c49670.c982f8","type":"debug","z":"a62b2385.ba7c8","name":"","active":true,"console":"false","complete":"false","x":210,"y":20,"wires":[]},{"id":"723eddcb.6c3004","type":"catch","z":"a62b2385.ba7c8","name":"","scope":null,"x":60,"y":20,"wires":[["b2c49670.c982f8"]]},{"id":"9302637.e6254a","type":"comment","z":"a62b2385.ba7c8","name":"Direct multiple inputs to specific output","info":"","x":370,"y":220,"wires":[]},{"id":"b6c91bfb.48a748","type":"comment","z":"a62b2385.ba7c8","name":"Gather data from Web, transform, and store","info":"","x":370,"y":440,"wires":[]},{"id":"37a5b272.eca84e","type":"http request","z":"ac461d84.e7abc","name":"Seinfeld Episodes","method":"GET","ret":"obj","url":"http://mysafeinfo.com/api/data?list=seinfeldepisodes&format=json","tls":"","x":270,"y":1420,"wires":[["a8b88122.da845"]]},{"id":"bd30b35.f05c45","type":"alafile out","z":"ac461d84.e7abc","name":"","filename":"","format":"xlsx","columns":"*","headers":true,"x":670,"y":1260,"wires":[]},{"id":"7506ce7.5cbf23","type":"inject","z":"ac461d84.e7abc","name":"Click Me","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":100,"y":1420,"wires":[["37a5b272.eca84e"]]},{"id":"a8b88122.da845","type":"function","z":"ac461d84.e7abc","name":"Set Filename","func":"// Reset the node status line\nnode.status({});\n// Error if working_dir not set\nif (global.get('working_dir') === '') {\n node.error('Working directory not set',msg);\n node.status({fill:'red',shape:'dot',text:'Working directory not set'});\n return;\n}\n// Set the filename to working_dir plus the name\nmsg.filename = global.get('working_dir') + 'seinfeld_episodes';\nreturn msg;","outputs":1,"noerr":0,"x":460,"y":1420,"wires":[["bd30b35.f05c45","53de6d0a.413344","3867363f.1189da","c7685a2f.8d6bb8","ee889cf.1cc2f6","b686bc6b.abb76","2e39aa6e.f54fa6"]]},{"id":"53de6d0a.413344","type":"alafile out","z":"ac461d84.e7abc","name":"","filename":"","format":"xls","columns":"*","headers":true,"x":670,"y":1320,"wires":[]},{"id":"3867363f.1189da","type":"alafile out","z":"ac461d84.e7abc","name":"","filename":"","format":"csv","columns":"*","headers":true,"x":670,"y":1380,"wires":[]},{"id":"c7685a2f.8d6bb8","type":"alafile out","z":"ac461d84.e7abc","name":"","filename":"","format":"json","columns":"*","headers":true,"x":670,"y":1440,"wires":[]},{"id":"ee889cf.1cc2f6","type":"alafile out","z":"ac461d84.e7abc","name":"","filename":"","format":"tab","columns":"*","headers":true,"x":670,"y":1500,"wires":[]},{"id":"b686bc6b.abb76","type":"alafile out","z":"ac461d84.e7abc","name":"","filename":"","format":"txt","columns":"*","headers":true,"x":670,"y":1620,"wires":[]},{"id":"a43b148d.59bee8","type":"http request","z":"ac461d84.e7abc","name":"Seinfeld Episodes","method":"GET","ret":"obj","url":"http://mysafeinfo.com/api/data?list=seinfeldepisodes&format=json","tls":"","x":290,"y":700,"wires":[["97b84e0b.db69a"]]},{"id":"5b550e05.6bb05","type":"inject","z":"ac461d84.e7abc","name":"Click Me","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":100,"y":700,"wires":[["a43b148d.59bee8"]]},{"id":"97b84e0b.db69a","type":"alafile out","z":"ac461d84.e7abc","name":"","filename":"./test/flotsam/files/seinfeld_episodes","format":"csv","columns":"*","headers":true,"x":670,"y":700,"wires":[]},{"id":"d1b0cd98.c7f98","type":"comment","z":"ac461d84.e7abc","name":"No filename given in either msg.filename or in the node configuration.","info":"","x":260,"y":1000,"wires":[]},{"id":"ed127e79.66396","type":"inject","z":"ac461d84.e7abc","name":"Click Me","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":90,"y":1040,"wires":[["d06be931.67d6e8"]]},{"id":"d06be931.67d6e8","type":"http request","z":"ac461d84.e7abc","name":"Seinfeld Episodes","method":"GET","ret":"obj","url":"http://mysafeinfo.com/api/data?list=seinfeldepisodes&format=json","tls":"","x":280,"y":1040,"wires":[["23de6c8d.edcd34"]]},{"id":"23de6c8d.edcd34","type":"alafile out","z":"ac461d84.e7abc","name":"","filename":"","format":"csv","columns":"*","headers":true,"x":660,"y":1040,"wires":[]},{"id":"a3f4e0fe.07655","type":"comment","z":"ac461d84.e7abc","name":"Output with Filename from msg.filename.","info":"","x":260,"y":760,"wires":[]},{"id":"b7bd33b3.2109e","type":"inject","z":"ac461d84.e7abc","name":"Click Me","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":100,"y":800,"wires":[["86837c7a.e4edb"]]},{"id":"86837c7a.e4edb","type":"http request","z":"ac461d84.e7abc","name":"Seinfeld Episodes","method":"GET","ret":"obj","url":"http://mysafeinfo.com/api/data?list=seinfeldepisodes&format=json","tls":"","x":290,"y":800,"wires":[["5d0325b9.f7649c"]]},{"id":"de1d8fe5.2b0aa","type":"alafile out","z":"ac461d84.e7abc","name":"","filename":"","format":"csv","columns":"*","headers":true,"x":670,"y":800,"wires":[]},{"id":"5d0325b9.f7649c","type":"function","z":"ac461d84.e7abc","name":"Set Filename","func":"// Reset the node status line\nnode.status({});\n// Error if working_dir not set\nif (global.get('working_dir') === '') {\n node.error('Working directory not set',msg);\n node.status({fill:'red',shape:'dot',text:'Working directory not set'});\n return;\n}\n// Set the filename to working_dir plus the name\nmsg.filename = global.get('working_dir') + 'seinfeld_episodes';\nreturn msg;","outputs":1,"noerr":0,"x":500,"y":800,"wires":[["de1d8fe5.2b0aa"]]},{"id":"1c247854.586f48","type":"comment","z":"ac461d84.e7abc","name":"Output with Filename in the node configuration","info":"","x":270,"y":660,"wires":[]},{"id":"41d45c2.74859a4","type":"comment","z":"ac461d84.e7abc","name":"ala sql file out - output format tests","info":"","x":160,"y":1280,"wires":[]},{"id":"b62ab8cc.0057a8","type":"comment","z":"ac461d84.e7abc","name":"No msg.payload","info":"","x":90,"y":1100,"wires":[]},{"id":"87faade0.07f03","type":"inject","z":"ac461d84.e7abc","name":"Click Me","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":90,"y":1140,"wires":[["d1702bfc.1663c8"]]},{"id":"d1702bfc.1663c8","type":"http request","z":"ac461d84.e7abc","name":"Seinfeld Episodes","method":"GET","ret":"obj","url":"http://mysafeinfo.com/api/data?list=seinfeldepisodes&format=json","tls":"","x":280,"y":1140,"wires":[["f062dcb5.e069"]]},{"id":"6c37d839.e5d2f8","type":"alafile out","z":"ac461d84.e7abc","name":"","filename":"","format":"csv","columns":"*","headers":true,"x":660,"y":1140,"wires":[]},{"id":"f062dcb5.e069","type":"function","z":"ac461d84.e7abc","name":"Delete Payload","func":"msg.filename = 'C:/Users/kim/Documents/seinfeld_episodes';\ndelete msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":1140,"wires":[["6c37d839.e5d2f8"]]},{"id":"6537dfb.1fb482","type":"comment","z":"ac461d84.e7abc","name":"ala sql file out - exception tests","info":"","x":150,"y":920,"wires":[]},{"id":"da8a5272.0aceb","type":"inject","z":"ac461d84.e7abc","name":"All Error out","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":240,"y":960,"wires":[["a925e2bd.4911e"]]},{"id":"9e7ccb56.153e68","type":"comment","z":"ac461d84.e7abc","name":"ala file out - basic tests","info":"","x":120,"y":580,"wires":[]},{"id":"a925e2bd.4911e","type":"http request","z":"ac461d84.e7abc","name":"Seinfeld Episodes","method":"GET","ret":"obj","url":"http://mysafeinfo.com/api/data?list=seinfeldepisodes&format=json","tls":"","x":440,"y":960,"wires":[["23de6c8d.edcd34","f062dcb5.e069"]]},{"id":"f2099ab0.455338","type":"http request","z":"ac461d84.e7abc","name":"Seinfeld Episodes","method":"GET","ret":"obj","url":"http://mysafeinfo.com/api/data?list=seinfeldepisodes&format=json","tls":"","x":450,"y":620,"wires":[["97b84e0b.db69a","5d0325b9.f7649c"]]},{"id":"f427d414.d1c588","type":"inject","z":"ac461d84.e7abc","name":"All Basic out","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":250,"y":620,"wires":[["f2099ab0.455338"]]},{"id":"e4556da3.51227","type":"comment","z":"ac461d84.e7abc","name":"Ala File In/Out Tests","info":"\nThese flows do some common tests of the `node-red-contrib-alasql` file in/out\nnodes.\n\nThe flows are pretty basic and use data describing episodes of the Seinfeld\ntv sitcom available from [http://mysafeinfo.com](http://mysafeinfo.com).\n\nThe data is at \n * http://mysafeinfo.com/api/data?list=seinfeldepisodes&format=json\n\nOther than the `node-red-contrib-alasql` nodes, all nodes used are in the\n`node-red` default install :\n * inject\n * catch\n * status\n * debug\n * function\n * comment\n * http request\n * ala file in\n * ala file out\n","x":110,"y":380,"wires":[]},{"id":"47cb7e32.68299","type":"inject","z":"ac461d84.e7abc","name":"Inject on \"Deploy\"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"x":130,"y":120,"wires":[["b55d8d79.0fb24"]]},{"id":"b55d8d79.0fb24","type":"function","z":"ac461d84.e7abc","name":"Set working directory","func":"// Set a global variable containing working directory for in/out files\n// Remember to put a trailing '/' and don't forget to Deploy! ;)\n\nglobal.set('working_dir','./test/flotsam/files/'); \n\nif (!global.get('working_dir')) {\n node.status({fill:'red',shape:'dot',text:'Working directory not set'});\n return;\n}\nelse {\n node.status({fill:\"green\",shape:\"dot\",text: ' ' + global.get(\"working_dir\")});\n}\nreturn msg;","outputs":1,"noerr":0,"x":360,"y":120,"wires":[[]]},{"id":"23165164.b4aefe","type":"comment","z":"ac461d84.e7abc","name":"Select comments and read 'Info' tab in the Sidebar (ctrl-space) for handy tips","info":"You might find some helpful information in the comments.\n\nOf course, you can delete them as you wish - they do not impact any of the flows.\n\n","x":370,"y":20,"wires":[]},{"id":"521cf346.90bbdc","type":"catch","z":"ac461d84.e7abc","name":"","scope":null,"x":220,"y":240,"wires":[["de3caa15.ec79c8"]]},{"id":"66422477.c36b0c","type":"comment","z":"ac461d84.e7abc","name":"Error / Status Handlers","info":"These are two flows which display errors and statuses.\n\n`node-red-contrib-alasql` nodes generally use status messages to display\nany issues that occur. Status messages are displayed in the 'Sidebar' \n(ctrl-space) *debug* tab. By default All Status messages are not routed to the\n`debug` tab (to prevent spaming the tab with a bunch of messages).\nTurn on/off by pressing the 'button' on rightside of the `To debug tab` node.\n\nError messages are displayed as a status underneath the `Error Message` node.\nThe button on the left of the `Reset` node clears the error message from the display.\n\nThe `Status filter` and `Error Message` function nodes can be edited to filter\nthe messages that are displayed.","x":120,"y":200,"wires":[]},{"id":"de3caa15.ec79c8","type":"function","z":"ac461d84.e7abc","name":"Error Message","func":"if (msg.error) {\n node.status({fill:'red',shape:'dot',text:msg.error.message});\n}\nelse {\n node.status({});\n}\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":240,"wires":[["9f985879.e44358"]]},{"id":"771ead99.d05234","type":"inject","z":"ac461d84.e7abc","name":"Reset","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"x":90,"y":240,"wires":[["de3caa15.ec79c8"]]},{"id":"a22bb312.bce4b","type":"comment","z":"ac461d84.e7abc","name":"Change the filename","info":"May wish to change the output `file name` of this node. The default file\npath/name assumes the node-red server was started with `npm test`.\n\nOptionally, change any other config parameters to your liking such as the\nformat.\n\nFeel free to delete this comment to get it outta the way.","x":730,"y":680,"wires":[]},{"id":"abb0c4f8.6ab878","type":"comment","z":"ac461d84.e7abc","name":"About the working directory","info":"`ala file in/out` files are read/written relative to the directory which\nnode-red was started on the server. \n\n*The default directory assumes the server was started by the `npm test` command\nfrom the directory which node-red-contrib-alasql is installed.*\n\nA fully qualified pathname can be entered that will take all the guess work\nout of it.\n\n*The directory must exist on the server. You can use forward slashes between\ndirectory names (even if running Windows) and remember the trailing '/' at the\nend of the directory path.*\n\nEdit the `Set working directory` function node to change the global `working_dir`\nvalue (at the beginning of the function) to the path where alasql files will be\nread/written.\n\nOpen the function and change the first line to be the path you wish files to\nbe stored. Deploy and the directory will be set. You could click\nthe `In/Out Directory` node button as well, but no needed.\n","x":130,"y":80,"wires":[]},{"id":"d58742b5.68ed9","type":"status","z":"ac461d84.e7abc","name":"","scope":null,"x":220,"y":300,"wires":[["8ec912ee.98a98"]]},{"id":"9f985879.e44358","type":"debug","z":"ac461d84.e7abc","name":"To debug tab","active":false,"console":"false","complete":"status.text","x":550,"y":240,"wires":[]},{"id":"8ec912ee.98a98","type":"function","z":"ac461d84.e7abc","name":"Status Filter","func":"if (msg.status.text && msg.status.text !== '') {\n return msg; \n}\nreturn;","outputs":1,"noerr":0,"x":370,"y":300,"wires":[["c489734c.4e0c1"]]},{"id":"5e6b018d.6211","type":"inject","z":"ac461d84.e7abc","name":"All Tests","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":100,"y":420,"wires":[["ea2e7703.222f08","a752e4d0.a3d818"]]},{"id":"4bba336d.9ad7bc","type":"link in","z":"ac461d84.e7abc","name":"All Basic out","links":["127db3ae.5eaa2c"],"x":535,"y":580,"wires":[["5d0325b9.f7649c","97b84e0b.db69a"]]},{"id":"127db3ae.5eaa2c","type":"link out","z":"ac461d84.e7abc","name":"Files out","links":["4bba336d.9ad7bc","b4f108c3.dd6738","f5be679b.0751f8"],"x":455,"y":420,"wires":[]},{"id":"b4f108c3.dd6738","type":"link in","z":"ac461d84.e7abc","name":"All Errors","links":["127db3ae.5eaa2c"],"x":535,"y":920,"wires":[["f062dcb5.e069","23de6c8d.edcd34"]]},{"id":"f5be679b.0751f8","type":"link in","z":"ac461d84.e7abc","name":"Format Tests out","links":["127db3ae.5eaa2c"],"x":335,"y":1380,"wires":[["a8b88122.da845"]]},{"id":"916944d2.20e7c8","type":"inject","z":"ac461d84.e7abc","name":"Click Me","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":100,"y":1940,"wires":[["b1336c8c.cc807"]]},{"id":"b1336c8c.cc807","type":"function","z":"ac461d84.e7abc","name":"Set Filename","func":"// Reset the node status line\nnode.status({});\n// Error if working_dir not set\nif (global.get('working_dir') === '') {\n node.error('Working directory not set',msg);\n node.status({fill:'red',shape:'dot',text:'Working directory not set'});\n return;\n}\n// Set the filename to working_dir plus the name\nmsg.filename = global.get('working_dir') + 'seinfeld_episodes';\nreturn msg;","outputs":1,"noerr":0,"x":250,"y":1940,"wires":[["9683d208.c494","3b2d6d2d.6e1912","788cbc80.2e0a54","e1d8ede.3fbbe1","126adc4d.29c084","416088f6.a614e8","2fbb1110.c55ade"]]},{"id":"a04bf706.73cd78","type":"comment","z":"ac461d84.e7abc","name":"ala sql file in - input format tests","info":"","x":150,"y":1680,"wires":[]},{"id":"416088f6.a614e8","type":"alafile in","z":"ac461d84.e7abc","name":"","filename":"","format":"xlsx","columns":"*","headers":true,"x":470,"y":1740,"wires":[["783ad840.84d8d8"]]},{"id":"783ad840.84d8d8","type":"function","z":"ac461d84.e7abc","name":"Count Records","func":"node.status({});\nvar record_count = msg.payload.length;\nif (record_count > 0) {\n node.status({fill:'green',shape:'dot',text:'Records: ' + record_count});\n}\nelse {\n node.status({fill:'red',shape:'dot',text:'Records: ' + record_count});\n}\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":1720,"wires":[[]]},{"id":"126adc4d.29c084","type":"alafile in","z":"ac461d84.e7abc","name":"","filename":"","format":"xls","columns":"*","headers":true,"x":470,"y":1820,"wires":[["e0d67eda.89c79"]]},{"id":"e1d8ede.3fbbe1","type":"alafile in","z":"ac461d84.e7abc","name":"","filename":"","format":"csv","columns":"*","headers":true,"x":470,"y":1900,"wires":[["3665c63f.4e1e4a"]]},{"id":"3b2d6d2d.6e1912","type":"alafile in","z":"ac461d84.e7abc","name":"","filename":"","format":"json","columns":"*","headers":true,"x":470,"y":1980,"wires":[["6a5fb619.bdacc8"]]},{"id":"9683d208.c494","type":"alafile in","z":"ac461d84.e7abc","name":"","filename":"","format":"tab","columns":"*","headers":true,"x":470,"y":2060,"wires":[["89d572a1.70ec"]]},{"id":"2fbb1110.c55ade","type":"alafile in","z":"ac461d84.e7abc","name":"","filename":"","format":"tsv","columns":"*","headers":true,"x":470,"y":2140,"wires":[["a5e9be55.f989c"]]},{"id":"5360ff6e.a5612","type":"comment","z":"ac461d84.e7abc","name":"Read from files created above","info":"","x":160,"y":1720,"wires":[]},{"id":"e0d67eda.89c79","type":"function","z":"ac461d84.e7abc","name":"Count Records","func":"node.status({});\nvar record_count = msg.payload.length;\nif (record_count > 0) {\n node.status({fill:'green',shape:'dot',text:'Records: ' + record_count});\n}\nelse {\n node.status({fill:'red',shape:'dot',text:'Records: ' + record_count});\n}\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":1800,"wires":[[]]},{"id":"3665c63f.4e1e4a","type":"function","z":"ac461d84.e7abc","name":"Count Records","func":"node.status({});\nvar record_count = msg.payload.length;\nif (record_count > 0) {\n node.status({fill:'green',shape:'dot',text:'Records: ' + record_count});\n}\nelse {\n node.status({fill:'red',shape:'dot',text:'Records: ' + record_count});\n}\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":1880,"wires":[[]]},{"id":"6a5fb619.bdacc8","type":"function","z":"ac461d84.e7abc","name":"Count Records","func":"node.status({});\nvar record_count = msg.payload.length;\nif (record_count > 0) {\n node.status({fill:'green',shape:'dot',text:'Records: ' + record_count});\n}\nelse {\n node.status({fill:'red',shape:'dot',text:'Records: ' + record_count});\n}\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":1960,"wires":[[]]},{"id":"89d572a1.70ec","type":"function","z":"ac461d84.e7abc","name":"Count Records","func":"node.status({});\nvar record_count = msg.payload.length;\nif (record_count > 0) {\n node.status({fill:'green',shape:'dot',text:'Records: ' + record_count});\n}\nelse {\n node.status({fill:'red',shape:'dot',text:'Records: ' + record_count});\n}\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":2040,"wires":[[]]},{"id":"a5e9be55.f989c","type":"function","z":"ac461d84.e7abc","name":"Count Records","func":"node.status({});\nvar record_count = msg.payload.length;\nif (record_count > 0) {\n node.status({fill:'green',shape:'dot',text:'Records: ' + record_count});\n}\nelse {\n node.status({fill:'red',shape:'dot',text:'Records: ' + record_count});\n}\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":2120,"wires":[[]]},{"id":"2e39aa6e.f54fa6","type":"alafile out","z":"ac461d84.e7abc","name":"","filename":"","format":"tsv","columns":"*","headers":true,"x":670,"y":1560,"wires":[]},{"id":"788cbc80.2e0a54","type":"alafile in","z":"ac461d84.e7abc","name":"","filename":"","format":"txt","columns":"*","headers":true,"x":470,"y":2220,"wires":[["8088bfff.e6c15"]]},{"id":"8088bfff.e6c15","type":"function","z":"ac461d84.e7abc","name":"Count Records","func":"node.status({});\nvar record_count = msg.payload.length;\nif (record_count > 0) {\n node.status({fill:'green',shape:'dot',text:'Records: ' + record_count});\n}\nelse {\n node.status({fill:'red',shape:'dot',text:'Records: ' + record_count});\n}\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":2200,"wires":[[]]},{"id":"ea2e7703.222f08","type":"delay","z":"ac461d84.e7abc","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":300,"y":500,"wires":[["9d32308a.1fd3b"]]},{"id":"9d32308a.1fd3b","type":"link out","z":"ac461d84.e7abc","name":"Files in","links":["dd55d61f.78f178"],"x":455,"y":500,"wires":[]},{"id":"dd55d61f.78f178","type":"link in","z":"ac461d84.e7abc","name":"Format Tests in","links":["9d32308a.1fd3b"],"x":135,"y":1900,"wires":[["b1336c8c.cc807"]]},{"id":"2b9785d.9f8567a","type":"comment","z":"ac461d84.e7abc","name":"Give time for files to written before reading them","info":"","x":400,"y":460,"wires":[]},{"id":"a752e4d0.a3d818","type":"http request","z":"ac461d84.e7abc","name":"Seinfeld Episodes","method":"GET","ret":"obj","url":"http://mysafeinfo.com/api/data?list=seinfeldepisodes&format=json","tls":"","x":330,"y":420,"wires":[["127db3ae.5eaa2c"]]},{"id":"c489734c.4e0c1","type":"debug","z":"ac461d84.e7abc","name":"To debug tab","active":false,"console":"false","complete":"status.text","x":550,"y":300,"wires":[]},{"id":"56b70796.8fc638","type":"inject","z":"ab9e1f5f.8ee36","name":"Click Me","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":100,"y":100,"wires":[["f378d60b.c61ed8"]]},{"id":"f378d60b.c61ed8","type":"function","z":"ab9e1f5f.8ee36","name":"Set Filename","func":"// Reset the node status line\nnode.status({});\n// Error if working_dir not set\nif (global.get('working_dir') === '') {\n node.error('Working directory not set',msg);\n node.status({fill:'red',shape:'dot',text:'Working directory not set'});\n return;\n}\n// Set the filename to working_dir plus the name\nmsg.filename = global.get('working_dir') + 'seinfeld_episodes';\nreturn msg;","outputs":1,"noerr":0,"x":250,"y":100,"wires":[["7a15ef18.ca808"]]},{"id":"7a15ef18.ca808","type":"alafile in","z":"ab9e1f5f.8ee36","name":"","filename":"","format":"json","columns":"*","headers":true,"x":390,"y":100,"wires":[["2e3b71f4.ee152e"]]},{"id":"2e3b71f4.ee152e","type":"alasql","z":"ab9e1f5f.8ee36","name":"","query":"SELECT * FROM ?","x":510,"y":80,"wires":[["7a3d62d3.91bcac"]]},{"id":"7a3d62d3.91bcac","type":"debug","z":"ab9e1f5f.8ee36","name":"","active":true,"console":"false","complete":"false","x":650,"y":100,"wires":[]},{"id":"78f346c4.033b68","type":"debug","z":"ab9e1f5f.8ee36","name":"","active":true,"console":"false","complete":"false","x":210,"y":20,"wires":[]},{"id":"23bae0d5.c15","type":"catch","z":"ab9e1f5f.8ee36","name":"","scope":null,"x":60,"y":20,"wires":[["78f346c4.033b68"]]}]