cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping - If then Else - dealing with Not

Former Member
0 Kudos

I have been working on what I thought was a simple mapping from one infotype to another.

Simply put:

IF

infotype 0006

-


> ANSSA = Z4

-


>WKWNG = X then infotype 0001-SACHA = W

IF

infotype 0006

-


> ANSSA = Z4

-


>WKWNG = ' ' then infotype 0001-SACHA = H

I thought this would be simple! The first statement is fine, however, the WKWNG is a Checkbox and I am having problems covnerting a blank value into the statement. Infact, it reutrns a W whatever is in the WKWNG!

I have tried createIF, mapWithDefault, fix values (x=True, ' '= false).

None have worked....

What is the best way to deal with this? ( I am attempting to write a UDF at the moment - but my Java skils only extend to introduction with OO Programming and Java)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Use euqalS, IfwithElse & Constant functions it will be solved.

It should be like

if WKWNG = X

0001-SACHA = W

else

0001-SACHA = H.

No need of UDF

Regards

Sushil

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks everyone!

Former Member
0 Kudos

Thanks to you all....

Maybe not efficient, but it works!!!

if (a.equals("X") && b.equals("Z4"))
return "W";
else { if( !a.equals("X") && b.equals("Z4"))
return "H"; 
}
return "";

Must get some Java Training!

Also, I found it easier to write the code in eclipse than notepad!

MichalKrawczyk
Active Contributor
0 Kudos

hi,

create UDF with two inpouts (a = ANSSA and b = WKWNG)

if ( (a.equals("Z4") and b.equals("X"))

{

return "W";

}

else

{

return "H";

}

Regards,

michal

Former Member
0 Kudos

Thanks Michal.

I have written something similar (badly), but there may be other values than Z4 and X.

if a.string( == 'Z4'), {

if b.string( == 'X'); {

c.string( = 'W')

} else

if a.string('Z4'), {

if b.string( <> 'X'),{

c.string( = 'H'),{

else.

}

}

}

}

Just attempting to debug errors in the coding at the moment (there are a few)!

MichalKrawczyk
Active Contributor
0 Kudos

hi Barry,

use equals method (like in my code) to check strings ok ?

you can also use else if

like shown in examples (IfElseDemo ) on page:

[Removed by the moderator.]

Regards,

michal

Former Member
0 Kudos

Thanks Michal (that was the page I was using!)

How do i deal with not equal "X" ?

Can't find that in Sun/Java tutorials for that!

Former Member
0 Kudos

Hi Barry,

>>>>How do i deal with not equal "X" ?

if(!a.equals("Z4")){

write your code...

}

Cheers!

Samarjit

Former Member
0 Kudos

Hi Barry,

>>>>How do i deal with not equal "X" ?

if(!a.equals("X")){

write your code here...

}

Cheers!

Samarjit