Question
· Aug 3, 2023

CSV to XML's, preferably without coding?

Hi,

Using Interoperability, I can't figure out how to create separate XML's files from a CSV-file using the GUI-features Record Maps/Complex Record Mapper -> Data Transformations. I'm familiar with reading/writing the files using File Service/Operation, but don't understand the processing-steps.
The preferred method by my colleagues is to do this without any Objectscript or Embedded Python coding, but if this can only be done by some coding that's fine as well.

See example below.
Any help is appreciated!

Kind regards,
Ties Voskamp

Example CSV:

PONumber;PODate;ArticleID;ArticleName;MeasureOfUnit;UnitPrice;UnitsOrdered
52001;2023-02-01;"AP12345";"Pencil Black 5mm";10;5.50;1
52001;2023-02-01;"AP12350";"Pencil Red 15mm";10;7.50;2
52003;2023-03-01;"AP12345";"Pencil Black 5mm";10;5.50;5
52003;2023-03-01;"AP12350";"Pencil Red 15mm";10;7.50;5
52003;2023-03-01;"AP12346";"Pencil Blue 5mm";10;5.50;3
52003;2023-03-01;"AP12347";"Pencil Green 5mm";10;5.50;2
52014;2023-04-21;"AP12345";"Pencil Black 5mm";10;5.50;5
52014;2023-04-21;"AP12350";"Pencil Red 15mm";10;7.50;5
52014;2023-04-21;"AP12346";"Pencil Blue 5mm";10;5.50;8

I need to create separate XML-files (one per unique PONumber) with the orderlines belonging to that PONumber.
Example output: PO52001.xml

<PurchaseOrder PONumber="52001" PODate="2023-02-01">
    <POLine>
        <ArticleID>AP12345</ArticleID>
        <ArticleName>Pencil Black 5mm</ArticleName>
        <MeasureOfUnit>10</MeasureOfUnit>
        <UnitPrice>5.50</UnitPrice>
        <UnitsOrdered>1</UnitsOrdered>
    </POLine>
    <POLine>
        <ArticleID>AP12350</ArticleID>
        <ArticleName>Pencil Red 15mm</ArticleName>
        <MeasureOfUnit>10</MeasureOfUnit>
        <UnitPrice>7.50</UnitPrice>
        <UnitsOrdered>2</UnitsOrdered>
    </POLine>
</PurchaseOrder>
Product version: IRIS 2023.1
Discussion (2)1
Log in or sign up to continue

When you create a RecordMapper to transform a CSV into an ObjectScript class you can add to the production a Business Process to receive the created object from the mapper, so you can transform it to XML (extending the ObjectScript class from %XML.Adaptor) and save it into a file created ad-hoc when you've received the first mapped row of the CSV (I guess that you can get from the original request the name of the original CSV file to identify the PONumber).