cancel
Showing results for 
Search instead for 
Did you mean: 

UDF to handle space value in Message mapping of PI

banersu
Participant
0 Kudos

Hi Experts,

Can anyone please tell me what is the code to remove the single  space coming in the field value of a xml tag and supresssthe Tag.

Eg>Source Xml:  <Name>  <Name>

      Target xml :<Name/>

I have written one but i donot know why it is not working.

For(int i = 0;i<var1.length();i++)

{

if(var1[i].trim.isEqual(""))

result.addValue(ResultLiss.SUPRESS);

else

result.addValue(var1[i]);

]

Could anyone tell me what shold be the exact one to validate space value .

Thanks,

Suparna Banerjee

Accepted Solutions (0)

Answers (3)

Answers (3)

banersu
Participant
0 Kudos

Hi experts,

Thanks for your suggestion.

it works fine.

I have one more query .

once we use this code the xml tag of Target  structure does not generated.

but some times in one to one mapping logic if we pass no value in the Source Xml structure then the target xml structure generated like <Name/>

What is the difference between these two means 1>.no Name tag generation and 2>generated like<Name\>...

Please help me to clear my concept

former_member186851
Active Contributor
0 Kudos

Hello Suparna.

1>.no Name tag generation---------- Tag is suppressed

2>.generated like<Name\>-------------Means tag with empty value.

Refer the below discussion for clear understanding

http://stackoverflow.com/questions/2279501/what-is-an-empty-element

former_member186851
Active Contributor
0 Kudos

Hello Suparna,

You can try the below logic using normal mapping functions as well

former_member182412
Active Contributor
0 Kudos

Hi Suparna,

Use this mapping.

Regards,

Praveen.