cancel
Showing results for 
Search instead for 
Did you mean: 

File Content Conversion: How do I ignore fields that sometimes contain spaces instead of real values?

Former Member
0 Kudos

Hi all,

I am doing content conversion (file sender adapter) using this configuration:

The input file is just a text file that looks like this:

John                   3th Avenue             Married  | (length of row is 55)

Chris                  3th Avenue             Married  | (length of row is 55)

Dude                   3th Avenue             Married  | (length of row is 55)

...


(| means end of line and is not included in the file)


After conversion it is of course put into xml. The xml structure has three fields: name, address and marit_stat. The field name is a required field while the other two fields are optional. An input file like this also works:


John                                          Married  | (length of row is 55)

Chris                                         Married  | (length of row is 55)

Dude                                          Married  | (length of row is 55)

...


This input file gives me xml with all three nodes, in which name is filled and the other nodes have no value (as the spaces are trimmed while converting, which is a default setting). I don't want this.


I only want to have the nodes which actually hold a value. The nodes address and marit_stat are defined as optional in the Datatype, so there can be cases in which they are not needed. There is of course the requirement for the input file to contain the maximum length of the values of the optional nodes, but I don't want these optional nodes as empty nodes in XML. I don't want them at all.


I know that I can achieve what I want by using a mapping, but I want to handle this before the message gets into PI.


So summing up, when I give this file:


John                                          Married  | (length of row is 55)

Chris                                         Married  | (length of row is 55)

Dude                                          Married  | (length of row is 55)

...


I want to have this structure (quick draft, may not be correct xml):


<MT_BLABLA>

   <INFO>

      <name>John</name>

   </INFO>
</MT_BLABLA>


..and not this one:


<MT_BLABLA>

   <INFO>

      <name>John</name>

      <address></address>

      <marit_stat></marit_stat>

   </INFO>
</MT_BLABLA>


Thanks a bunch guys (and girls)!

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member186851
Active Contributor
0 Kudos

Hello Zakaria,

Try the below parameter

Info.missingLastFields----------Ignore

Converting Text Format in the Sender File/FTP Adapter to XML - Advanced Adapter Engine - SAP Library

Former Member
0 Kudos

Hello Raghuraman,

missingLastFields is only used if the rows in the input file have less fields than specified in the configuration, which is not the case here. All the fields are present in the input file. Spaces are also seen as values, but while converting the spaces are trimmed resulting in empty xml nodes.

I don't want these empty xml nodes. The input file is also not mine, so I can't change the structure of the input file.

former_member186851
Active Contributor
0 Kudos

Zakari,

So if you wish to suppress the space values I believe it can be handled in the mapping.

Just use exists and create if and map it to the target node.

I guess no standard FCC parameter available for this.

Former Member
0 Kudos

try using

info.fieldContentFormatting = trim

Former Member
0 Kudos

The value of fieldContentFormatting is trim by default, so I don't have to specify this again?

Former Member
0 Kudos

this is optional parameter.. you need to define and set as trim.

  1. NameA.fieldContentFormatting

·  Specify trim to remove all the leading and subsequent blanks for a value found.

·  Specify nothing to ensure that the value remains unaltered.

This parameter is optional.

Former Member
0 Kudos

You can check this link. You'll find this image:

Or perhaps I am not seeing something here?

engswee
Active Contributor
0 Kudos

Hi Zakaria

Sorry to disappoint you but what you are asking for (suppressed XML fields for columns with empty content) cannot be achieved at FCC level. The XML fields will always be there (and trimmed by default).

You can double check the source code yourself:-

Regards

Eng Swee