# Incomplete read out from text string ( file )

**URL:** https://discourse.nodered.org/t/incomplete-read-out-from-text-string-file/18492
**Category:** General
**Created:** [27 November 2019 04:45 UTC](https://discourse.nodered.org/t/incomplete-read-out-from-text-string-file/18492 "2019-11-27T04:45:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Hard-a-Port](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hard-a-port/32/6606_2.png) [@Hard-a-Port](https://discourse.nodered.org/u/Hard-a-Port)
#### Post date: [27 November 2019 04:45 UTC](https://discourse.nodered.org/t/incomplete-read-out-from-text-string-file/18492/1 "2019-11-27T04:45:09Z")

</div>

Greetings. New to the node-red paltform ( and most else ) but was wanting to read a text file from a file and seemed to be getting only a part of it as output. Other text files read completely.  
This text file is a result of a hardware device string throwing out data. The idea is to then map it with known header tags and get a sensible output.  
Any ideas guys?

here is the code.

```auto
[{"id":"cd014bcf.450f38","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"b772ca63.471af","type":"debug","z":"cd014bcf.450f38","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":648,"y":143,"wires":[]},{"id":"3fae45ac.b8a56a","type":"inject","z":"cd014bcf.450f38","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":107,"y":111,"wires":[["e7f50c8b.da80e"]]},{"id":"e7f50c8b.da80e","type":"file in","z":"cd014bcf.450f38","name":"","filename":"/Users/Vaishakh/Desktop/data.txt","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":373,"y":124,"wires":[["b772ca63.471af"]]}]

```

Here is the text file:

```auto
20191025104608,D, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, RUN , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, STOP, , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM,A HIGH, NORM, NORM, NORM, NORM,A LOW ,I NORM, NORM, NORM, NORM, NORM, NORM, NORM, RUN , , RUN , , RUN , S/B , S/B , RUN , RUN , S/B , S/B , RUN , S/B , , STOP, , , STOP, RUN , STOP, STOP, NORM, STOP, NORM, NORM, NORM, NORM, NORM, NORM, NORM, STOP,R LOW ,R LOW ,R NORM, NORM,R LOW ,R NORM,R LOW ,R NORM, NORM, NORM, NORM,R NORM, NORM, NORM, NORM, NORM, NORM, NORM, STOP,R LOW ,R LOW ,R NORM, NORM,R LOW ,R NORM,R LOW ,R NORM, NORM, NORM, NORM,R NORM, NORM, NORM, NORM, NORM, NORM, NORM, STOP, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, RUN , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, S/B , NORM, NORM,I NORM, NORM, STOP, NORM, NORM, RUN , NORM, NORM, RUN , NORM, NORM, STOP, NORM, NORM, STOP, STOP, STOP, NORM, NORM, NORM, NORM, RUN , NORM, NORM, NORM, NORM, STOP, NORM, NORM, NORM, NORM, NORM, NORM, RUN , NORM, NORM, NORM, SUP , RUN , RUN , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM,A ALAM, STOP, NORM,A TRBL, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, OFF , ON , ON , OFF , OFF , OFF , OFF , OFF , OFF , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, OFF , OFF , OFF , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM,A ABNR, NORM5120191025104613,P,58865526,13142.58, 729.33, 728.01, 3896, 8373, 6658, 2181, 8140.18,13044.26,10083.21,12178.39, 9468.50,12882.50,11841.47,11117.47,11695.39, 9295.15, 8716.16,12155.37, 700.14, 1809.35, 848.21, 1499.05, 1911.39, 2439.32,18942.39, 8102.11, 319.58, 217.01,10127.12, 9581.17, 8700.19, 8151.08, 11.22,11388.33, 4488.19,16560.56, 8123.37, 1909.47, 1267.31,18015.57,20120.29,20201.52, 9347.12, 9453.48, 4422.43,12280.14, 0.37,23070.49,23070.49*5C20191025104613,A, 80.7, 80.6, 13033, 74.2, 2.253, 56.0, 56.1, 56.5, 58.1, 59.0, 59.1, 0.529, 0.531, 84.2, 91.2, 90.4, 92.0, 91.8, 90.6, 91.3, 0.163, 0.249, 0.246, 52.1, 65.3, 38.3, 38.6, 51.6, 60.1, 56.2, 56.8, 56.8, 57.0, 56.8, 56.9, 0.697, 133.2, 99.8, 69.2, 0.312, 2.156, 3.692, 0.204, 0.100, 0.121, 2.357, 4.389, 357.6, 350.1, 332.9, 339.7, 335.2, 343.6, 14.4, 6.9, -10.3, -3.5, -8.0, 0.4, 343.2, 395.2, 254.2, 0.182, 48.4, 0.621,R 57.9,R 65.5, 43.5, 48.7, 0,R 59.1,R 64.4, 52.1, 47.6, 0, 57.0, 72.9, 421.5, 422.7, 298, 2.252, 2.125, 0.703*5C20191025104613,D, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, RUN , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, STOP, , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM,A HIGH, NORM, NORM, NORM, NORM,A LOW ,I NORM, NORM, NORM, NORM, NORM, NORM, NORM, RUN , , RUN , , RUN , S/B , S/B , RUN , RUN , S/B , S/B , RUN , S/B , , STOP, , , STOP, RUN , STOP, STOP, NORM, STOP, NORM, NORM, NORM, NORM, NORM, NORM, NORM, STOP,R LOW ,R LOW ,R NORM, NORM,R LOW ,R NORM,R LOW ,R NORM, NORM, NORM, NORM,R NORM, NORM, NORM, NORM, NORM, NORM, NORM, STOP,R LOW ,R LOW ,R NORM, NORM,R LOW ,R NORM,R LOW ,R NORM, NORM, NORM, NORM,R NORM, NORM, NORM, NORM, NORM, NORM, NORM, STOP, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, RUN , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, S/B , NORM, NORM,I NORM, NORM, STOP, NORM, NORM, RUN , NORM, NORM, RUN , NORM, NORM, STOP, NORM, NORM, STOP, STOP, STOP, NORM, NORM, NORM, NORM, RUN , NORM, NORM, NORM, NORM, STOP, NORM, NORM, NORM, NORM, NORM, NORM, RUN , NORM, NORM, NORM, SUP , RUN , RUN , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM,A ALAM, STOP, NORM,A TRBL, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, OFF , ON , ON , OFF , OFF , OFF , OFF , OFF , OFF , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, OFF , OFF , OFF , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM,A ABNR, NORM*5B20191025104618,P,58865532,13142.58, 729.33, 728.01, 3896, 8373, 6658, 2181, 8140.18,13044.26,10083.21,12178.39, 9468.50,12882.50,11841.47,11117.47,11695.39, 9295.15, 8716.16,12155.37, 700.14, 1809.35, 848.21, 1499.05, 1911.39, 2439.32,18942.39, 8102.11, 319.58, 217.01,10127.12, 9581.17, 8700.19, 8151.08, 11.22,11388.33, 4488.19,16560.56, 8123.37, 1909.47, 1267.31,18015.57,20120.29,20201.52, 9347.12, 9453.48, 4422.43,12280.14, 0.37,23070.49,23070.49*5220191025104618,A, 80.5, 80.5, 13031, 74.9, 2.253, 56.0, 56.1, 56.5, 58.1, 59.0, 59.1, 0.529, 0.529, 84.2, 91.2, 90.4, 92.0, 91.8, 90.6, 91.3, 0.163, 0.243, 0.248, 52.1, 65.3, 38.3, 38.6, 51.6, 60.1, 56.2, 56.8, 56.7, 57.0, 56.7, 56.8, 0.696, 133.2, 99.8, 69.2, 0.312, 2.156, 3.696, 0.204, 0.100, 0.121, 2.357, 4.389, 357.6, 350.0, 332.9, 339.7, 335.1, 343.6, 14.4, 6.9, -10.3, -3.5, -8.0, 0.4, 343.2, 395.1, 254.2, 0.182, 48.4, 0.622,R 57.9,R 65.5, 43.5, 48.7, 0,R 59.1,R 64.4, 52.1, 47.6, 0, 57.0, 72.9, 421.5, 422.7, 297, 2.251, 2.125, 0.703*5820191025104618,D, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, RUN , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, STOP, , NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM, NORM,  

```

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [27 November 2019 07:18 UTC](https://discourse.nodered.org/t/incomplete-read-out-from-text-string-file/18492/2 "2019-11-27T07:18:44Z")

</div>

The debug panel will only show a part of any large object to save space and bandwidth. The actual output from the node will be complete. If you set the debug to output to the console you should see the complete file.

---

<div class="post-metadata">

### Author: ![Hard-a-Port](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hard-a-port/32/6606_2.png) [@Hard-a-Port](https://discourse.nodered.org/u/Hard-a-Port)
#### Post date: [27 November 2019 08:47 UTC](https://discourse.nodered.org/t/incomplete-read-out-from-text-string-file/18492/3 "2019-11-27T08:47:22Z")

</div>

Thanks. I reckon that means in the log file.  
Have managed to separate the putouts and log to an Excel sheet, so i'm kinda making progress I guess.  
However, I don't know if reading from a file equates to reading serial output from a device.  
This is the only way I have at my disposal to test.  
( Btw, I tried to write the output to file as well; as suggested in some other posts on the forums )

---

<div class="post-metadata">

### Author: ![Hard-a-Port](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hard-a-port/32/6606_2.png) [@Hard-a-Port](https://discourse.nodered.org/u/Hard-a-Port)
#### Post date: [27 November 2019 09:00 UTC](https://discourse.nodered.org/t/incomplete-read-out-from-text-string-file/18492/4 "2019-11-27T09:00:57Z")

</div>

Here is a bit of what I'm trying to do. I hope I'm n the rig The idea is to read from a device that throws out data on a serial port but does not have any header or tags associated with it. So what I intend to do later is to see if I can map the serial outputs to the tags and then log to a database.

( Hope I'm making sense )

```auto
[{"id":"7d648e91.20849","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"58440d4b.64dbd4","type":"inject","z":"7d648e91.20849","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":120,"wires":[["71b11fd8.4299"]]},{"id":"71b11fd8.4299","type":"file in","z":"7d648e91.20849","name":"","filename":"C:\\Users\\chavanv\\Desktop\\BEMAC.txt","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":510,"y":120,"wires":[["9430a127.bfd26","f3970228.3a13f","ae1cf109.62c5e","7bc93f04.f7129","e455274b.03ace8","ebff2148.f1c46","ceeec2e.a19cb4"]]},{"id":"9430a127.bfd26","type":"debug","z":"7d648e91.20849","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":930,"y":160,"wires":[]},{"id":"f3970228.3a13f","type":"split","z":"7d648e91.20849","name":"","splt":",","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":true,"addname":"","x":770,"y":320,"wires":[["e8ca0aa0.a5a0f8","e711378b.f08cd8"]]},{"id":"e8ca0aa0.a5a0f8","type":"debug","z":"7d648e91.20849","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":950,"y":320,"wires":[]},{"id":"ae1cf109.62c5e","type":"file","z":"7d648e91.20849","name":"","filename":"C:\\Users\\chavanv\\Desktop\\trial.txt","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":1000,"y":120,"wires":[[]]},{"id":"e711378b.f08cd8","type":"function","z":"7d648e91.20849","name":"str.slice","func":"var out1 = msg.payload;\nvar chopped = out1.slice(0,15);\nmsg.payload = chopped;\nreturn msg;","outputs":1,"noerr":0,"x":780,"y":380,"wires":[["2d17f3f7.52bc2c"]]},{"id":"2d17f3f7.52bc2c","type":"debug","z":"7d648e91.20849","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":950,"y":380,"wires":[]},{"id":"7bc93f04.f7129","type":"function","z":"7d648e91.20849","name":"str.split","func":"var out1 = msg.payload;\nvar chopped = out1.split(',',284);\nmsg.payload = chopped;\nreturn msg;","outputs":1,"noerr":0,"x":780,"y":420,"wires":[["206050f7.b1235","7b3af2c1.ca047c","be044866.3cb888"]]},{"id":"206050f7.b1235","type":"debug","z":"7d648e91.20849","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":950,"y":420,"wires":[]},{"id":"e455274b.03ace8","type":"function","z":"7d648e91.20849","name":"str.substring","func":"var out1 = msg.payload;\nvar chopped = out1.substring(0,2000);\nmsg.payload = chopped;\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":460,"wires":[["3f46a195.500dee","8cfd9feb.06b7e","829911bb.d6171"]]},{"id":"3f46a195.500dee","type":"debug","z":"7d648e91.20849","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":950,"y":460,"wires":[]},{"id":"8cfd9feb.06b7e","type":"function","z":"7d648e91.20849","name":"str.split","func":"var out1 = msg.payload;\nvar chopped = out1.split(',',100);\nmsg.payload = chopped;\nreturn msg;","outputs":1,"noerr":0,"x":960,"y":580,"wires":[["fa93be2d.5a8c6"]]},{"id":"fa93be2d.5a8c6","type":"debug","z":"7d648e91.20849","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1130,"y":580,"wires":[]},{"id":"ebff2148.f1c46","type":"function","z":"7d648e91.20849","name":"str.match on D ( global )","func":"var out1 = msg.payload;\nvar chopped = out1.match(/D/g);\nmsg.payload = chopped;\nreturn msg;","outputs":1,"noerr":0,"x":1010,"y":620,"wires":[["82f3dc06.74cb2"]]},{"id":"82f3dc06.74cb2","type":"debug","z":"7d648e91.20849","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1210,"y":620,"wires":[]},{"id":"829911bb.d6171","type":"function","z":"7d648e91.20849","name":"str.match","func":"var out1 = msg.payload;\nvar chopped = out1.match(/P/g);\nmsg.payload = chopped;\nreturn msg;","outputs":1,"noerr":0,"x":960,"y":660,"wires":[["fe556749.58b8d8"]]},{"id":"fe556749.58b8d8","type":"debug","z":"7d648e91.20849","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1130,"y":660,"wires":[]},{"id":"ceeec2e.a19cb4","type":"function","z":"7d648e91.20849","name":"str.length","func":"var out1 = msg.payload;\nvar chopped = out1.length;\nmsg.payload = chopped;\nreturn msg;","outputs":1,"noerr":0,"x":960,"y":720,"wires":[["fabfb6a1.906b58"]]},{"id":"fabfb6a1.906b58","type":"debug","z":"7d648e91.20849","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1130,"y":720,"wires":[]},{"id":"9c17bc18.a208c","type":"debug","z":"7d648e91.20849","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1130,"y":780,"wires":[]},{"id":"7b3af2c1.ca047c","type":"function","z":"7d648e91.20849","name":"str.length","func":"var out1 = msg.payload;\nvar chopped = out1.length;\nmsg.payload = chopped;\nreturn msg;","outputs":1,"noerr":0,"x":960,"y":780,"wires":[["9c17bc18.a208c"]]},{"id":"be044866.3cb888","type":"csv","z":"7d648e91.20849","name":"","sep":"\\t","hdrin":"","hdrout":"","multi":"one","ret":"\\n","temp":"","skip":"0","strings":false,"x":990,"y":260,"wires":[["348f9a3d.7e31e6","18de3f9a.15c1f"]]},{"id":"348f9a3d.7e31e6","type":"debug","z":"7d648e91.20849","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1190,"y":300,"wires":[]},{"id":"18de3f9a.15c1f","type":"file","z":"7d648e91.20849","name":"","filename":"C:\\Users\\chavanv\\Desktop\\trial3.xls","appendNewline":false,"createDir":true,"overwriteFile":"false","encoding":"none","x":1260,"y":260,"wires":[[]]}]

```
