cancel
Showing results for 
Search instead for 
Did you mean: 

Converting MT100 file into XML using FCC

nitindeshpande
Active Contributor
0 Kudos

Hello Experts,

I have a requirement to convert the MT100 into XML file. Please find below the requirement and let me know how we can convert it using FCC or is there any idea to convert it.

Please note one payment ranges from tag 20 to tag 70 and the file can contain 'N' number of payments and each payments must be picked up and put into the XML field as mentioned below in the XML structure.


From ECC end, they can add some characters to mark the start and end of the payment. For example below. Here ampersand (&) and Apostrophe (') has been used as identifier, like this we can use any characters as identifiers


& ----------------> Character informing about start of the payment

20:123456789

:32A:150805SAR1000,

:50:/0107002268360010

ANB

P.O.BOX 1111,

City1- 11492

Country 1

:52A:compcode

:57A:compcode

:59:/10700500032323

Test Vendor

1-44,Test street

SA - 21485

-------------------------------->  Character informing about end of the payment

& ----------------> Character informing about start of the payment

:70:No.TEST1/5.8.2015

:20:1500000123

:32A:150805SAR3000,

:50:/0107002268360010

Bank

P.O.BOX 8524,

City- 11492

Country 2

:52A:compcode

:54A:/0107002268360010

compcode

:57A:compcode

:59:/10700500032323

Test vendor 2

SA -

:70:No.TEST3/5.8.2015

' -------------------------------->  Character informing about end of the payment


The above mentioned txt structure must be converted into the below format of XML -

<PaymentMessage>

<PaymentTransaction>

<SequenceNum>1234567894</SequenceNum>

<TransactionData>

:20:1234567894 :32A:150805SAR1000, :50:/0107002268360010 ANB P.O.BOX 1111, City1- 11492 Country 1 :52A:compcode :57A:compcode :59:/10700500032323 Test Vendor 1-44,Test street SA - 21485 :70:No.TEST1/5.8.2015

</TransactionData>

</PaymentTransaction>

<PaymentTransaction>

<SequenceNum>1500000123</SequenceNum>

<TransactionData>

:20:1500000123 :32A:150805SAR3000, :50:/0107002268360010 Bank P.O.BOX 8524, City- 11492 Country 2 :52A:compcode :54A:/0107002268360010 compcode :57A:compcode :59:/10700500032323 Test vendor 2 SA - :70:No.TEST3/5.8.2015

</TransactionData>

</PaymentTransaction>

</PaymentMessage>


I have also attached the .txt file and .xml file to the note. Please refer to it if needed.


Any help on this will be highly appreciated.


Regards,

Nitin

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos
nitindeshpande
Active Contributor
0 Kudos

Hi Rajendar,

Thanks a lot for your reply.

I guess this works out for converting XML into text, but i would need the reverse. Text to XML. Do we have similar Adapter module for text to XML or we need to go with FCC itself?

Regards,

Nitin Deshpande

Former Member
0 Kudos

HI Nitin,

I believe FCC not working for this, we need go for Adapter module only. if you have Source xml structure please share to us.

and find below link may it will help to you.

Adding StrictXml2PlainBean (XML to Text) in the Module Processor - Adding Modules to the Module Proc...

regards,

Rajendra

nitindeshpande
Active Contributor
0 Kudos

Hi Rajendar,

Sorry if i have confused you.

The source is text here and target should be XML.

Source - Text

Target - XML

Please find below the data for connecting the system (you can also find these details in my initial post also and also the source and target file has been attached to the initial post) -

Source Data -

& ----------------> Character informing about start of the payment

20:123456789

:32A:150805SAR1000,

:50:/xxxxxxxxxxxxxxxx

ANB

P.O.BOX 1111,

City1- 11492

Country 1

:52A:compcode

:57A:compcode

:59:/xxxxxxxxxxxxxxxx

Test Vendor

1-44,Test street

SA - 21485

-------------------------------->  Character informing about end of the payment

& ----------------> Character informing about start of the payment

:70:No.TEST1/5.8.2015

:20:1500000123

:32A:150805SAR3000,

:50:/xxxxxxxxxxxxxxxxx

Bank

P.O.BOX 8524,

City- 11492

Country 2

:52A:compcode

:54A:/xxxxxxxxxxxxxxxx

compcode

:57A:compcode

:59:/xxxxxxxxxxxxxxxxxx

Test vendor 2

SA -

:70:No.TEST3/5.8.2015

' -------------------------------->  Character informing about end of the payment


Target Data -


<PaymentMessage>

<PaymentTransaction>

<SequenceNum>1234567894</SequenceNum>

<TransactionData>

20:123456789

:32A:150805SAR1000,

:50:/xxxxxxxxxxxxxxxx

ANB

P.O.BOX 1111,

City1- 11492

Country 1

:52A:compcode

:57A:compcode

:59:/xxxxxxxxxxxxxxxx

Test Vendor

1-44,Test street

SA - 21485

</TransactionData>

</PaymentTransaction>

<PaymentTransaction>

<SequenceNum>1500000123</SequenceNum>

<TransactionData>

:70:No.TEST1/5.8.2015

:20:1500000123

:32A:150805SAR3000,

:50:/xxxxxxxxxxxxxxxxx

Bank

P.O.BOX 8524,

City- 11492

Country 2

:52A:compcode

:54A:/xxxxxxxxxxxxxxxx

compcode

:57A:compcode

:59:/xxxxxxxxxxxxxxxxxx

Test vendor 2

SA -

:70:No.TEST3/5.8.2015

</TransactionData>

</PaymentTransaction>

</PaymentMessage>

RaghuVamseedhar
Active Contributor
0 Kudos

Nitin,

This is not possible using FCC or standard modules. Please try this blog or Java Mapping.

nitindeshpande
Active Contributor
0 Kudos

Hi Raghu,

Yes, i realize that it is not possible through FCC. Hence i am writing an UDF to concatenate the payments and put each payment in the single field and i have marked this field as 1 to unbounded. But unfortunately i get only one output value.

Please find below my Source and Target MT and kindly let me know where i am doing the mistake. I know i am doing the silly mistake, need your help to recognize it.

Source MT -

Target MT -

Mapping -

Regards,

Nitin Deshpande

Former Member
0 Kudos

do you see the expected values in after the UDF? - rt click and do display queue. at the end of UDF use split by value node function..

RaghuVamseedhar
Active Contributor
0 Kudos

Nitin,

I think, Source Data Type is wrong. I would recommend, configuring below scenario in sandbox, then with that experience you can solve your issue.

nitindeshpande
Active Contributor
0 Kudos

Raghu,

There was a context mismatch and i have fixed the issue.

But now i am facing issue with the "Null" string which is coming in the context of my mapping. I am not sure why this is coming as a part of data in the mapping. When i check the input data separately using hex viewer, i do not find any such string, So i have a strong feeling that, it is getting in the mapping. Can you please help me with this?

Please find below the screenshots for more info -

Null String in Context -

Concatenate UDF where the "Null" string may be getting added.

Regards,

Nitin

RaghuVamseedhar
Active Contributor
0 Kudos

Nitin,

null is getting adding due to this statement (first time Output[j] is null).

Output[j] = Output[j]+Transactions[i] + "\n";

There is no need of this loop

for (int j=0; j<1;j++) { }.

Try this UDF


    public void Concatenate(String[] Transactions, ResultList Transaction_Data, Container container) throws StreamTransformationException {

        String Output = "";

        for (String Transaction : Transactions) {

            if (!Transaction.startsWith("ten")) {

                Output = Output + Transaction + "\r\n";

            }

        }

        Transaction_Data.addValue(Output);

    }