muledataweavemulesoftanypoint-studioflat-file

How to parse Flat File Schema to mulesoft object


I have requirement where I need to parse MuleSoft Flat File Schema to parse incoming file content, input file row to parse it and convert to Mule object. It should include parsing of multiple rows in a file with 5-7 attributes per row. I have seen many examples but no one is explaining how can we create flatFile schema to process the flat file in anypoint studio. Could you please help me for the same.

Input file -

1220612WEBL23555606CA01                                                                                                                                                                                                                               
200000162608361   FFVV220606D915552982635 4TKTT0140MAZUR/ISWAR APRIL                                             C    YXYYXY    /C9F6R1     MTHO                             DTD 0000                                       
G002389100000000000CAD2070231 0 996AC                              001          RESLE BALANCE                                                                                                                                   
700CAD     0.00            NO ADC      00                                                                                       0                                                                                       00142152020558 Y262990535  
889486594HGMRNL8785   00000000000082204CAD2  CC5  0423                             0423                     000000000020512   00000000000      CAD2  EX                                                                  000000      
8002389                   00000000000      CAD2  CA                                                                  00000000000                   00000000000                                                                                00000000000      
9002389                                                                                                                                                   AGT6490/00                                    CASH                                               
Z00625                                                                                                                                                                                                                                                   

Solution

  • The basic steps are simple:

    1. Define the structure of the file. You need to understand the records and fields of the file completely.
    2. Convert that definition into a Flat file schema. Read the documentation, if the file has simple records structure it should be very direct.
    3. Use the schema in a DataWeave transformation

    Flat file format are usually custom defined. It is very very unlikely that there is a tool to automatically translate it to a flat file definition since they lack delimiters and structure. You will have to read the definition of the structure and create the flat file schema manually. For that you need to understand how the flat files schemas are structured by reading the documentation. They are not complex, but you may want to start with simpler examples until you get the hang of it.