# File-in count line (msg.parts.count) on per line message

**URL:** <https://discourse.nodered.org/t/file-in-count-line-msg-parts-count-on-per-line-message/23577>\
**Category:** General\
**Created:** [24 March 2020 17:30 UTC](https://discourse.nodered.org/t/file-in-count-line-msg-parts-count-on-per-line-message/23577 "2020-03-24T17:30:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bug00](https://avatars.discourse-cdn.com/v4/letter/b/9de0a6/32.png) [@bug00](https://discourse.nodered.org/u/bug00)\
**Post date:** [24 March 2020 17:30 UTC](https://discourse.nodered.org/t/file-in-count-line-msg-parts-count-on-per-line-message/23577/1 "2020-03-24T17:30:01Z")

</div>

Hi,

I had parrallel node that follow a file-in, msg per line config. Node is asynchro and the order of my line in entry is not same when i join.

I can do a split node who take a string buffer, then i had the msg.parts.count that sort node ask for group.

There is a way to get the count total line attach to msg in a split loop ?

It's just for sort before join. We need to keep the order of line after processing

Thanks.

An exemple flow, need to create c:\exemple.txt whith line ended by \n

```auto
[{"id":"91aad4bc.a1aa18","type":"tab","label":"test","disabled":false,"info":""},{"id":"a8bae8d9.bc0058","type":"inject","z":"91aad4bc.a1aa18","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":100,"wires":[["6989bd7d.98e8ac"]]},{"id":"6989bd7d.98e8ac","type":"file in","z":"91aad4bc.a1aa18","name":"","filename":"C:\\exemple.txt","format":"lines","chunk":false,"sendError":false,"encoding":"none","x":200,"y":160,"wires":[["cc797d6.71f5b8"]]},{"id":"34c13ca8.494b8c","type":"debug","z":"91aad4bc.a1aa18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1010,"y":380,"wires":[]},{"id":"8d5df5bf.f76ed","type":"join","z":"91aad4bc.a1aa18","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":830,"y":340,"wires":[["34c13ca8.494b8c"]]},{"id":"cc797d6.71f5b8","type":"switch","z":"91aad4bc.a1aa18","name":"","property":"bool","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"false","repair":false,"outputs":2,"x":170,"y":260,"wires":[["b15f65af.1f353"],["a82711e5.d24e68"]]},{"id":"9f4069c7.b4bff","type":"change","z":"91aad4bc.a1aa18","name":"Modifier ligne","rules":[{"t":"set","p":"payload","pt":"msg","to":"$substring($match(payload, /^TVEC1R.*\\r?\\n?$/).match, 0, 10)&\t$substring($match(payload, /^TVEC1R.*\\r?\\n?$/).match, 0, 10)&\t$substring($match(payload, /^TVEC1R.*\\r?\\n?$/).match, 0, 10)&\t$substring($match(payload, /^TVEC1R.*\\r?\\n?$/).match, 0, 10)&\t$substring($match(payload, /^TVEC1R.*\\r?\\n?$/).match, 0, 10)&\t$substring($match(payload, /^TVEC1R.*\\r?\\n?$/).match, 0, 10)&\t$substring($match(payload, /^TVEC1R.*\\r?\\n?$/).match, 0, 10)&\t$substring($match(payload, /^TVEC1R.*\\r?\\n?$/).match, 0, 10)&\t$substring($match(payload, /^TVEC1R.*\\r?\\n?$/).match, 0, 10)&\t$substring($match(payload, /^TVEC1R.*\\r?\\n?$/).match, 0, 10)&\t$substring($match(payload, /^TVEC1R.*\\r?\\n?$/).match, 0, 10)&\t$substring($match(payload, /^TVEC1R.*\\r?\\n?$/).match, 0, 10)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":300,"wires":[["b15f65af.1f353"]]},{"id":"a82711e5.d24e68","type":"delay","z":"91aad4bc.a1aa18","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":340,"y":300,"wires":[["9f4069c7.b4bff"]]},{"id":"73bdc401.f038fc","type":"sort","z":"91aad4bc.a1aa18","name":"","order":"ascending","as_num":false,"target":"payload","targetType":"msg","msgKey":"payload","msgKeyType":"elem","seqKey":"payload","seqKeyType":"msg","x":890,"y":250,"wires":[["8d5df5bf.f76ed"]]},{"id":"b15f65af.1f353","type":"change","z":"91aad4bc.a1aa18","name":"even/odd","rules":[{"t":"set","p":"bool","pt":"msg","to":"$not(bool)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":250,"wires":[["73bdc401.f038fc"]]}]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 May 2020 17:30 UTC](https://discourse.nodered.org/t/file-in-count-line-msg-parts-count-on-per-line-message/23577/2 "2020-05-23T17:30:12Z")

</div>

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