cancel
Showing results for 
Search instead for 
Did you mean: 

XI Mapping - Replace character with an empty tag

0 Kudos

I am looking on how to replace the ? character with an empty tag. For example, when field1 = ? , I need just an empty tag for field1 or <field1></field1>

Or in other words, if field1 = ? , produce empty tag, or else produce whatever value it holds.

Accepted Solutions (0)

Answers (5)

Answers (5)

nidhi_srivastava22
Active Contributor
0 Kudos

Hi,

You can use if-else function, if it equals "?" then pass empty constant else pass the same value.

Source field - TAGE , Target field -D_98

Thanks,

Nidhi

former_member186851
Active Contributor
0 Kudos

Hello Ryan,

Try replaceString function(String Function)

Input----------------------

Constant ?---------------- Replace String---------------------Output

Constant[]--------------

http://wiki.scn.sap.com/wiki/display/HOME/Message+Mapping++Replace+String

Former Member
0 Kudos

you can use replaceString text function - replace ? with blank constant.

justin_santhanam
Active Contributor
0 Kudos

Ram,

He can use that , but how can retain the source value if it's not "?".. He needs to use boolean function to see if it's "?" then use ReplaceString, else retain the source value. The FixValues does the same in the background , isn't it ..

Thanks!

Former Member
0 Kudos

Replacestring will just replace whatever characters mentioned and retain the other characters. for E.g if your source value has test?test -  output will be testtest. no boolean is required.

As per his requirement some time field will have ? or values.. so it should work.

justin_santhanam
Active Contributor
0 Kudos

Okay sorry, I overlooked at it. You are correct, but still not sure if it will help his requirement. It's upto Ryan to test it out that suits his need.

For example, let say he wants to replace 100 with blank space for Field1, your logic will work if the field is 100 or if the field is 200 or etc.. But it defeats the purpose if the Field1 has 100000. The result will be 000. Isn't it.. I'm sorry if I'm missing any logic here..

Thanks!

justin_santhanam
Active Contributor
0 Kudos

Ryan,

Use the below function. (FixValues)

Thanks!

Former Member
0 Kudos

Hi Ryan

use replace all method in udf

field1.replaceAll("\\?","");