Camel Smooks EDIFACT to configure the decimal format

Asked by 5 months ago
In D10B CNI Segment I Need to control the decimal format while encode and decode. i.e. For some segments i don't need any Decimal Points and for some segments i need Decimal Points. e.g. For D10B IFTDGN SEGMENT7/CNI i don't need any decimal precision but the D10B CUSEXP SEGMENT7/CNI i need decimal precision(Both in encode and decode). So the question is i need to configure Common Segments decimal encoder and decoder per EDI Types. Is this possible with the Smooks EDIFACT. If not any workaround. Thanks

Your Answer


All Answers

Answer by 5 months ago
I have the exact same question. The customs department wants for some reason an exact number of decimals in the EDIFACT Invoic message and default won't do. I've found examples on how to change number format here: but I can't put the example into my context. (EDI/Smooks/Camel) Where do you add the configuration in the example? What's the namespace of the xml example? I'm guessing the configuration could be added with StringWriter ediOutStream = new StringWriter(); InputStream resourceConfigStream = new FileInputStream("myconfig.xml"); D96AInterchangeFactory factory = D96AInterchangeFactory.getInstance(); factory.addConfigurations(resourceConfigStream); factory.toUNEdifact(envelope, ediOutStream); How is the data attribute specified when working with EDI instead of XML? <jb:value property="price" decoder="BigDecimal" data="orderItem/price EDI FORMAT??"> <jb:decodeParam name="format">#,###.##</jb:decodeParam> <jb:decodeParam name="locale">en_GB</jb:decodeParam> </jb:value>