cancel
Showing results for 
Search instead for 
Did you mean: 

How to compre two fields: one whith Decimal and other without decimal?

Former Member
0 Kudos

Hi all,

I am doing a file to IDOC scenario.

In file strcture I have to compare two fields.

ActiveHSCode and Decree166HSCode where

ActiveHSCode comes with decimal values like for eg 1234.56.789.0 and Decree166HSCode comes with values like for eg 1234567890 or 4567891230 etc.

I have to ignore decimal point from ActiveHSCode and compare with Decree166HSCode,

If both of them are equal I have set ActiveIndicator as'Y' else 'N' and map this field to IDOC's field.

How to achieve this?

Please suggest.

Regards,

Sachi

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Since all the fields in mapping comes by default as a string ....

you first extract the value from ActiveHSCode using the string functions.

Then compare the

ActiveHSCode and Decree166HSCode.

Since u want to check only for the equality dont convert them to numbers.

Directly check as a string.

The code for extracting the value without decimal value is..

String s = "12345.6789";

s=s.substring(0,s.indexOf(".")) s.substring(s.indexOf(".")1);

System.out.println(s);

result:123456789

Babu.

Former Member
0 Kudos

Hi,

try using Text function replaceString and replace decimal with nothing........so the decimal will be removed........then use Text function equalS operation to compare them............then using if else map the output field.......

Regards.

Rajeev Gupta

Edited by: RAJEEV GUPTA on Feb 4, 2010 1:12 PM

Edited by: RAJEEV GUPTA on Feb 4, 2010 1:17 PM