Segment Counter

I have to populate the CNT segment of an EDIFACT message with a segment count.

Not all of the segments, simply those that lie between the UNH and UNT segments, including the CNT itself.

I know there is a convertToString function that will count all segments, but I do not think this will give me what I need.

UNH+0000001+DESADV:D:97A:UN
BGM+351+34602773+9
DTM+11:20140617:102
CNT+2:3
UNT+5+0000001

I know I can set up a crude transformer after I create each segment, but it doesn’t seem very elegant.

Any suggestions.

Paul

I think CNT in EDIFACT is not total number of segments but a total functionally related to the data like total number of line in Invoice/PO or total weight or number of units etc. which you can always count while making the EDI.

For Despatch Advice you know how many lines in it.

Thank you