cancel
Showing results for 
Search instead for 
Did you mean: 

Message mapping - IF Else simple query

tharaka_fernando
Contributor
0 Kudos

Dear All Experts,

Below is my nodes structure that is defined.

Logic :

When NUMBER   = 100 then get VALUE

     ELSE NUMBER   = 200 then get VALUE

(First should check NUMBER = 100 in all nodes (ITEMS), if not only NUMBER = 200 should be evaluated. NUMBER can have any value other than 100, 200 )

I tried with IF ELSE condition like below but Display Queue is producing "Null" values when there are "NUMBER" other than 100 or 200.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Fernando,

Do like below.

Regards,

Santhi

Former Member
0 Kudos

Hi Fernando,

Do like below.  then no need to put remove context and collapse context.  It works for your requirement.

Regards,

Santhi

tharaka_fernando
Contributor
0 Kudos

Hi Santi,

Thank you for your reply..

I tried as per you example.

but Ex : say 200 comes first then 100 comes after that. It will take 200 as the result. But requirement is First Look 100 in all "ITEMS" nodes - "NUMBER" element. If there is no 100 ONLY , then check for  200.

BUT if 200 and 100 both there , then we need to take 100. But as per above it takes 200.

if there is no 100 or 200 then produce a blank value. "NUMBER" element can have 100, 200, 300 , 400, ....n

pvishnuvardan_reddy
Active Contributor
0 Kudos

Fernando,

Just use remove context node funtion and then sort the Number field before giving as input and for Value field use remove context node funtion and then sort by key(key is Number field) before giving as input. Like below:

pvishnuvardan_reddy
Active Contributor
0 Kudos

In the above mapping screen shot,

replace MaterialN with Number field

replace MaterialGr with Value field

as per your requirement.

Reward points if solution is found useful

Regards

Vishnu

pvishnuvardan_reddy
Active Contributor
0 Kudos

Fernando,

check the below logic:

Instead of MaterialN - use Number according to your structure

Instead of MaterialGr - use Value according to your structure

Hope it matches your requirement.

Reward points if the solution is found useful

Regards

Vishnu

Harish
Active Contributor
0 Kudos

Hi Fernando,

your mapping is having context problem. For every false in if statement you need else value and that will not come in current logic.

if the target needs only value then try the below logic

[1]

Number --> map with default (blank) --> equals (100) -->> If without else (map the value in then)

[2]

Number --> map with default (blank) --> equals (200) -->> If without else (map the value in then)

input to if condition

[1] --> map with defailt (blank) --> equals (blank) --> Not

Then input

[1]

Else input

[2]

If the above logic is not clear then i can provide you the mapping screenshot.

regards,

Harish

tharaka_fernando
Contributor
0 Kudos

Hi Harish,

mapping screenshot is highly appreciated for better understanding...plz..

thanks

Former Member
0 Kudos

Hi Fernando,

do like below.  add  sort function from node functions between removecontext and collapse context functions.

Regards,

Santhi

tharaka_fernando
Contributor
0 Kudos

Hi Santi,

Thanks for the answer. Its working fine.

but only concern is that "NUMBER" should have vlaue 100 or 200 in your case. If there is no satisfying value (100 or 200) for the condition, mapping execution is unsuccessful. Giving an error.

Former Member
0 Kudos

Hi Fernando,

What should be the result if the NUMBER doesn't contain either 100 or 200?

ex:  NUMBER  is 300, 400, 500 what should be the value filled up with?

Regards,

Santhi

pvishnuvardan_reddy
Active Contributor
0 Kudos

Fernando,

check the below logic:

Instead of MaterialN - use Number according to your structure

Instead of MaterialGr - use Value according to your structure

Hope it matches your requirement.

Reward points if the solution is found useful

Regards

Vishnu

Harish
Active Contributor
0 Kudos

Hi Fernando,

Please find the mapping snapshot. Please replace Name with Number and Sal with value.

tharaka_fernando
Contributor
0 Kudos

Hi Santi,

then the value should be blank..element should be created as "VALUE" but empty values.

thanks

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Fernando,

Can you let us know the display queue screen shots of Number & Value fields, so that we can have clear understanding on where it is going wrong.

tharaka_fernando
Contributor
0 Kudos

Hi,

When Testing ;

  • If I put 100 first , then result is success.since the IF ELSE condition is TRUE at first instance.
  • If I put 200 first and then after that 100, then it is taking 200 as the result , which should be 100 since it is the priority in the logic

  • If I put some other values (300, 400, 500) and the 100 , the result is "blank" node. Please refer below

thanking all in advance