TIS 3.1.3.
I have an input csv file with empty fields that I want to convert to xml. How do I get tFileOutputXML not to output empty tags or in a more advanced case tFileOutputMSXML ( I unchecked Create empty element if needed but it made no difference). The generated Java code appears to only check for null values not empty values.
I tried to reproduce your issue with a similar structure but it works fine for me...
Is the generated file structure ok when you link directly the tFileInputDelimited to the tFileOutputMSXML or tAdvancedFileOutputXML?
Can you share an example of your input file? Are the values of the others sections (z303,z305,z308) the same for each row of this file?
I've tried to attach some test data but it doesn't seem to let me.
The data below is tab delimited.
A 02 111111111 MR WICK, ALEX 19840930 03 PGRAD Y ENG P M 01 03 01 X 02 111111111 00 AC H X AAA50 PT 03 20140930 A 01 01 MR ALEX WICK 12 THE STREET PLACE CITY % 334455667788 A.wick@AAA.COM
A 02 111111111 MR WICK, ALEX 19840930 03 PGRAD Y ENG P M 01 03 01 X 02 111111111 00 AC H X AAA50 PT 03 20140930 A 02 03 MR ALEX WICK 10 THE DRIVE THERE TOWN AB4 4AF 2324536335 A.wick@AAA.COM
A 02 111111111 MR WICK, ALEX 19840930 03 PGRAD Y ENG P M 01 03 01 X 02 111111111 00 AC H X AAA50 PT 03 20140930 X 03 % % % % %
A 02 222222222 MISS FISHER, HELEN 19870723 02 UGRAD Y ENG P F 01 03 01 X 02 222222222 00 AC H A AAA50 UF 02 20120615 A 01 01 MISS HELEN FISHER 10 THE RD HERE CITY AE2 3AR 3245645758 a.fisher@aaa.com
A 02 222222222 MISS FISHER, HELEN 19870723 02 UGRAD Y ENG P F 01 03 01 X 02 222222222 00 AC H A AAA50 UF 02 20120615 A 02 02 MISS HELEN FISHER 14 ANOTHER RD TOWN COUNTY AG10 8AT 23535647567 a.fisher@aaa.com
A 02 222222222 MISS FISHER, HELEN 19870723 02 UGRAD Y ENG P F 01 03 01 X 02 222222222 00 AC H A AAA50 UF 02 20120615 X 03 % % % % %
A 02 333333333 MR MACK, ALEX 19870401 03 PGRAD Y ENG P M 01 03 01 X 02 333333333 00 AC H A AAA50 PF 03 20100930 X 01 01 MR ALEX MACK 26 THE AVENUE SOMEWHERE AE2 2AP a.mack@aaa.com
A 02 333333333 MR MACK, ALEX 19870401 03 PGRAD Y ENG P M 01 03 01 X 02 333333333 00 AC H A AAA50 PF 03 20100930 A 02 03 MR ALEX MACK A HOUSE A ROAD A TOWN A COUNTY 235356467467 a.mack@aaa.com
A 02 333333333 MR MACK, ALEX 19870401 03 PGRAD Y ENG P M 01 03 01 X 02 333333333 00 AC H A AAA50 PF 03 20100930 X 03 % % % % %
Well I've managed to get it to work in TOS3.2.0.M3_r28760 using the tReplace to replace empty strings with null. Now all I have to do is get it to work at 3.1.3.
If it works in TOS3.2.0.M3, I think it's probably a bug in 3.1.3 which has been resolved. I'm now able to reproduce the issue in TOS 3.1.3. The problem seems to appear when there are null values in other sections than the loop one. When I first try it today, I had null values only in the loop section, that's why everything worked fine. Does anyone have any info about this? Regards, Karine
Another option would be in the tMap, use an expression that checks the length of the string, if its 0 then send null as the output, do something like this:
StringHandling.LEN(theValue) == 0 ? null : theValue