cancel
Showing results for 
Search instead for 
Did you mean: 

how to handle the whitespace in receiver file content converion

Former Member
0 Kudos


Hi Experts,

In Receiver file content conversion we are facing issue with white space charecters- lets example  value -999, but in receiver field fixed lengh we have defined as 20 lengh as per the requirement. But, in the output file we are getting [negative sign taking as first char and value filling last] - ********* 999.       ****** are white space charecters.

Is there any content conversion paramter for avoiding this type of white space charecters in receiver file content conversion ?

Best Regards.

Krushi.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182455
Active Contributor
0 Kudos

Hi krushi,

you can try to use the below UDF for removing the white spacess.

public  String removeTrailingWhiteSpaces(String str) {

            str = str.replaceAll("(?s)([ \t]*)$", "");

            str = str.replaceAll("\r\n", "\n");

            str = str.replaceAll("\r", "\n");

            str = str.replaceAll("(?s)([ \t]*)\n", "\n");

            str = str.replaceAll("(?s)([\n]*\n)", "\n");

            return str;

      }

Regards

srinivas

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi

This is really strange. -999 should have converted to ****************-999 not like - ********* 999.

Can you please check in PI and figure out what value has been sent from the adapter engine.

May be your PI mapping has generated that value.

Former Member
0 Kudos

hi All,

I presume that there is something missing UDF coding as per the below.

please advise on this.

input to conversion of 437.72- to -437.72 is mapping is executing correclty. but, receiver file content conversion we have defined as amout value as 20.

so -ve sign taking first place char and remaining moving to last charecters, and whitespaces are filling in the middle.

Now i need to do the trailing of white space charecters. I have tried all above suggested options but nothing works.

for(int count=0;count<input.length; count++)

{

    if(input[count].endsWith("-"))

     {

    result.addValue("-"+input[count].substring(0,input[count].length()-1));

     }

    else

        {

    result.addValue(input[count]);

        }

}

Thanks and Regards,

Krushi.

Former Member
0 Kudos

Hi All,

The neccessary corrections done existing UDF and problem is resolved.

0 Kudos

Hi Krushi,

Check the below threads

Regards,

Sudha

Former Member
0 Kudos
Former Member
0 Kudos

Hi Krushi,

Please check below thread

Regards,

Krupa