cancel
Showing results for 
Search instead for 
Did you mean: 

PI Graphical Editor Functions - Compare group of values in IF condition

nkr1shna
Contributor
0 Kudos

Hello All,

I have below requirement. In the source structure I have field say "WORDS". In the target mapping I would like to get this logic.

IF WORDS = 'ABC' OR WORDS = 'EFG' OR WORDS = 'XYZ'.

ASSIGN WORDS to Target field

Else

Assign 'UNKNOWN' constant to target field.

Endif.

Can anyone provide me some clue how to achieve above functionality using graphical editor functions.

Regards

Krishna

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Krishna

Use fixValues and generate "true" for the inpuit WORDS = 'ABC' OR WORDS = 'EFG' OR WORDS = 'XYZ'

And make default as "false" for other values. now use a IF function to pass the input value for true and 'UNKNOWN' in case of false,

Regards

Raj

nkr1shna
Contributor
0 Kudos

HI Raj,

Solution provided by you as elegant without creating too much funcitons in the graphical mapping editor.

I would like to "Thank" each and every expert in answering my question, appreciate your time and support.

Best Regards,

Krishna

Answers (3)

Answers (3)

former_member191435
Contributor
0 Kudos

HI,

or comparing WORDS with ABC, EFG or XYZ use constant, OR(boolean) functions then use ifelse.

Words

or

ABC(Constant)

or

EFG(Constant)

or

XYZ (Constant)

if else TARGET

UNKNOWN(Constant)

if u still face prob let me know.

Thanks,

Enivass

Former Member
0 Kudos

Hi Krishna,

Try using the below UDF, we can use graphical functions but you have add more functions which doesnt look good;

String words="";

if(a.equals("abc")||a.equals("efg")||a.equals("xyz"))

{

words=a;

}

else

{

words="UNKNOWN";

}

return (words);

- Muru

Former Member
0 Kudos

use combination of equals(text), "OR" (boolean function), ifthen else functions to achieve ur output...simple approach will be..


words
          ------------equals
constant(ABC)
                ---OR ---OR(mapping of 2nd input to OR)---IFTHEN ELSE( WORDS-----then, constant(UNKNOWN)---ELSE)----OUTPUT
words
          ----------equals
constant(ABC)

mapping of 2nd input
words
          ----------------equals-----2nd input to OR
constant(XYZ)