1

I am trying to create aperak-edifact file from mule data weaver component. Here is my piece of code

<edifact-edi:config name="EDIFACT_EDI" delimiterUsage="USE_SPECIFIED_FOR_WRITES" doc:name="EDIFACT EDI" interchangeIdPartner="YYYY" interchangeIdSelf="XXXX">
       <edifact-edi:schemas>
            <edifact-edi:schema>/edifact/d98b/APERAK.esl</edifact-edi:schema>
       </edifact-edi:schemas>
    </edifact-edi:config>
    <flow name="new1Flow">
        <file:inbound-endpoint path="C:\Users\Desktop" responseTimeout="10000" doc:name="File">
            <file:filename-regex-filter pattern="aperak.xml" caseSensitive="true"/>
        </file:inbound-endpoint>
        <dw:transform-message doc:name="Transform Message">
            <dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
{
    Messages: {
        D98B: {
            APERAK: [{
                Interchange: {
                    UNB0201: "XXX",
                    UNB0301: "YYYY"
                },
                MessageHeader: {
                    UNH01: "1"
                },
                Heading: {
                    "0020_BGM": {
                        BGM0101: "7"
                    }
                }
            }]
        }
    }
}]]></dw:set-payload>
        </dw:transform-message>
        <edifact-edi:write config-ref="EDIFACT_EDI"   doc:name="EDIFACT EDI"/>
        <file:outbound-endpoint path="C:\Users\Desktop" outputPattern="out.json" responseTimeout="10000" doc:name="File"/>        
    </flow>

Output

UNB+UNOB:4+XXX+YYY+05042016:0948+1'UNH+2+APERAK:D:98B:UN'BGM+7'UNT+3+2'UNZ+1+1'

But the output created is all in one line where I want it to be appeared line by line. So how can I introduce new line for edifact Any help is appreciated

Expected Output

UNB+UNOB:4+XXX+YYY+05042016:0948+1'
UNH+2+APERAK:D:98B:UN'
BGM+7'
UNT+3+2'UNZ+1+1'
mule-user
  • 223
  • 5
  • 22
  • Have you tried stting the `lineEnding` configuration attribute of the `edifact-edi:config`? – David Dossot Apr 06 '16 at 03:13
  • @ David Dossot : Yes I tried that it created as desired. Do you know if there is a way we can stop creating segment UNB – mule-user Apr 06 '16 at 05:50
  • No, sorry, check the config http://mulesoft.github.io/edi-module/edifact/mule/edifact-edi-config.html#config there may be an option for this? – David Dossot Apr 06 '16 at 14:39

1 Answers1

0

Set the lineEnding configuration attribute of edifact-edi:config to output a CRLF.

David Dossot
  • 33,403
  • 4
  • 38
  • 72