cancel
Showing results for 
Search instead for 
Did you mean: 

How to acheive IF elseif elseif else condition using std mapping functions

Former Member
0 Kudos

How to perform the following mapping using standard graphical functions:

if (a = 1)

result.addValue("3");

else if (a = 2)

result.addValue("6");

else if (a = 5)

result.addvalue("7");

else if (a = 10)

result.addValue("11");

else

result.addValue(a);

can this requirement be acheived without using a UDF?

Regards

bhasker

Accepted Solutions (1)

Accepted Solutions (1)

aashish_sinha
Active Contributor
0 Kudos

Hi,

It is not necessary to use UDF always. I know java i can write a Java code for any of complex or simple scenario. But what if people don't know basic java. So they will must go with standard mapping, so i guess what you want to know.

In your requirement.

If a = 1

use ifElse component in ur grafical mapping

give constant a value as 1.

then check if A.EqualS(1). EqualS is a standard function given in XI. If equal give the value you want to first success condition.

Fo second condition

add one more IFElse.

Check it until you done. and provide values in first and sencond success. provide the output to above second success of IF recursively.

I don't have any snap right now.

May be like this

Field | _ Equals - If - Success - Value | Final value -


Final field

Constant | - Output value |

field | _ EqualS - If -Success - value | _ Output value

Constant | else Constant - xyz |

I don't know if i am clear but you can try like this.

Regards

Aashish Sinha

Former Member
0 Kudos

Hi Bhaskar

By using standard functions it can be possible, check the below link

If A = 1 then 3

else if A=2 then 6

else if A=5 then 7

else if A=10 then 11

else A.

Former Member
0 Kudos

Dear ALL

Thank u for your suggestions and feedback.

Dear Aashish

if you can provide a screen shot or link to such mapping it would be of great help.

i am able to check the first IF condition but how to map the ElSEIF ...........ELSEIF loop in the mapping ?

Only IF is enough or should we use IFs standard function

Regards

Bhasker

former_member518917
Participant
0 Kudos

UDF is better way to get this done.

you try like this using Standard function:

Const 3 /THEN

(A equals 1) IF (output of ifThenElse) ->TragetFiled

\ELSE

/THEN /(output of IfThenElse input to else of first If)

IF /

\ELSE

Like wise for other conditions....

In else part of ifThenElse, give the output of second ifThenElse. here in ths case you need four ifThenElse.

CodeGenerated:

/ns0:MT_/targetFIELD = iF(const([value=3]), stringEquals(/ns0:MT_XML_OB/A=, const([value=1])),

iF(const([value=6]), stringEquals(/ns0:MT_XML_OB/A=, const([value=2])),

iF(const([value=7]), stringEquals(/ns0:MT_XML_OB/A=, const([value=5])),

iF(const([value=11]), stringEquals(/ns0:MT_XML_OB/A=, const[value=10])), /ns0:MT_XML_OB/A=))))

Ritu

Edited by: Ritu Sinha on Apr 13, 2009 2:48 PM

Former Member
0 Kudos

Hi Bhaskar,

The flow is

IfElse is required here

A Equals 1 -


IfThenElse----


>Result

3----If

Else

A Equals 2 IfThenElse

6---if

else

|

IfThenElse

........

Edited by: Venkataramesh Boppana on Apr 13, 2009 2:55 PM

Former Member
0 Kudos

Thank u one and all for your responses

Ritu's suggest worked for me

Regards

Bhasker

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

You can do with standard xi functions also.

but better use UDF it looks neat and straight forward and readable for further changes.

If done with MM takes time to understand what is logic than UDF

srini

JoelTrinidade
Active Contributor
0 Kudos

hi Bhasker,

Did you do some R&D with the standard mapping functionalities given. If that does not solve your problem than i guess UDF is the way out.

Regards

joel

Former Member
0 Kudos

U Should use UDF for this

Rajesh