Camel Smooks EDIFACT to configure the decimal format

Asked by 8 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

Name:
Reply:

All Answers

Answer by 8 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: https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_SOA_Platform/5/html/Smooks_User_Guide/chap-Producing_Output_Data.html#Number-Based_DataDecoderDataEncoder_Example1 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>