cancel
Showing results for 
Search instead for 
Did you mean: 

PI 7.4 Message mapping issue - IF statement not handling my price amendments.

former_member233999
Participant
0 Kudos

So i've got a flat file pi is picking up. Two fields for price, unit price and price..

I've written a if statement like the attached.

I was hoping that in there, because i've written a EqualsS and used IF. I could pass values that have 0.00 value and send them as 0.01 values, the reason for this is the purchase requisition in ECC cant handle 0.00 values. 

This doesnt seem to work as the XML being passed still is having 0.00 values as per the test source file im sending in..

Attached is my source file, below is my output in XML.  Any ideas what im doing wrong?

Accepted Solutions (1)

Accepted Solutions (1)

former_member184720
Active Contributor
0 Kudos

EqualS should work. Did you test your mapping locally? You can even use the displayqueue(right click on if then else -> display queue)  function to verify the same.

Make sure that the mapping objects is activated and cache is updated.

former_member233999
Participant
0 Kudos

Mapping works internally, results below. Just when the XML is generated, it comes out with an incorrect price. Its like it loses whatever PI does to the file when the xml is generated...

    

I've also been told to handle blank prices. Would i just create another IF statement - any ideas how i can handle both blank prices and those with 0.00 price?

azharshaikh
Active Contributor
0 Kudos

Hello George,

1. Since its working in your local testing, there seems to be issue with Cache. Can you do some dummy changes, SAve & Activate again. Check whether Cache is Up To Date in monitoring.

2. For your next query on checking for Blank, you cna simply add 1 more OR condition to your check.

UnitCost equalsS 0.00

OR

UnitCost equalsS ""

Ands then pass the Output of this OR to IF Else Condition.

Hope it helps

Regards,

Azhar

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi George,

The mapping logic is good. The issue might be due to cache issue. Just copy that message mapping with another name in ESR. Mention this new MM in your OM. After this, test end to end and check the output.

Regarding your blank query, I echo with Azhar, besides comparing with 0.00 value, also check with a balnk value and give these two outputs to a OR boolean function-->remaining everything remains as it is.

Regards

Vishnu

former_member233999
Participant
0 Kudos

Thanks Azhar,

This has been helpful and i've gotten it to pass the right data.


But now theres another issue, in that i need to handle a 3rd condition. If the price comes across as as single zero.  i.e   '0'

Should i just put a if statement in that says 'If prices = less than 0.01, then use constant of 0.01. and then the OR if price = '  ' then use constant 0.01?

What would be useful is an example of the mapping functions - including graphics. Does anybody know of such a Url?

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi George,

You can just check if it is '0' or not, and pass this output to the first argument of OR boolean function, the second argument to the OR function is the output of previous OR function output-->pass this output to the existing IF function.

Regards

Vishnu

Answers (1)

Answers (1)

former_member193376
Active Contributor
0 Kudos

It has to work. i am not sure how you are getting 0.00 in your output. i am assuming that the condition is false cause the "else" part is getting executed. may be there is a space or so, use trim function and check.


Regards,

Saiyog