on 08-22-2010 6:13 PM
Hi Folks,
One small clarification please, Can we remove '<null> or [] or SUPPRESS' from queue contexts? is yes, can any one answer how to do that please?
from source side if the condition is not fulfill then the 'null'/Suppress' is passing to the target. I want to remove 'null/Suppress' any where in a queue context.
Your response will be much appreciates!!
Many Thanks in Advance
Regards
San
First use RemoveContext function and then use below UDF code.
Use "Queue" radio button while creating the UDF..
for(int i = 0; i < a.length; i++)
{
if(! a<i>.equals(u201Du201D))
result.addValue( a<i> );
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sarvesh,
Many thanks for your great support. I shouldn't use remove context for business logic. I am using PI 7.11 version, some reason this function is thrwoing error like
Source text of object Message Mapping: MM_EDI_ProAct_One_N_W_1 | urn:rjr:snc:productactivedata has syntax errors:
Function removeSUPPRESS, Line 3:
illegal character: 8221
if(! a<i>.equals(âu20AC? âu20AC?))
^
Function removeSUPPRESS, Line 3:
illegal character: 8221
if(! a<i>.equals(âu20AC? âu20AC?))
^
Function removeSUPPRESS, Line 4:
')' expected
result.addValue( a<i> );
^
3 errors
Any inputs please?
Kind Regards
San
Is this the same UDF code which I provided in my previous post, is throwing error? If yes then you might have directly copied and pasted into your UDF. Some time some hidden footprint comes along with the code which you can't see with your eyes, so either you write the code by yourself or first paste it into notepad and then from there you can copy to your UDF.. so try it like this and let us know...
Please have a look this jpeg from following link sarvesh.
http://img842.imageshack.us/img842/6066/donotneednull.jpg
Many Thanks
Regards
San
Use the UDF just after CollapseContext and then use the SplitByValue, I mean switch over the places of UDF & SplitByValue.
I have one question, I can see in your mapping you have used SplitByValue (value change) (the one which is after CollapseContext), Why?? As per my knowledge "BuyerID" will have 0..1 or 1:1 occurrance, so if in one context change there will be more than 1 entries then which of the value you will be mapping to BuyeID??
I guess there will be only 1 value per context change, if so then you can simply use SplitByValue(each value).
Sarvesh,
No, I am getting the same result. I have changed UDF place after collapse and before, still I am getting '[]' value in the queue. I have changed Splitvalue - eachvalue. You are right, after collapse, any way we get only one value from each context, either way Splitvalue will work, I believe, please correct me if I am wrong.
Can we remove only one context, if context hasn't got values, without using remove context Standard Function?
Many Thanks for your help.
Kind Regards
San
> No, I am getting the same result. I have changed UDF place after collapse and before, still I am getting '[]' value in the queue. I have changed Splitvalue - eachvalue.
The UDF code which I have given will work 100% . [See the results here..|http://www.flickr.com/photos/23639237@N02/4919461846/]
I can see in your screen shot there is a <null> at the top of the queue which is weird because normally the top value comes as SUPPRESS, so in my opinion there is something wrong in your input values or there is some problem in your system.
I am not sure at this moment but it seems you may have to rais a message to SAP for this issue. But before this see all the queue value and try to figure out where this <null> is coming in your queue (I mean after which standard function).
>You are right, after collapse, any way we get only one value from each context, either way Splitvalue will work, I believe, please correct me if I am wrong.
Yes it will work either way in this case but we should use the correct options
Hi Sarvesh,
Let me explain the situation. I have got one xml message from source side like follows
<ROOT>
<OUTPUT>
<OUTPUT>
<OUTPUT>
</ROOT>
Basically the above <ROOT> is group of vendors information, One OUTPUT represents one vendor, In one vendor, I have got 'n' number products information, like promotional sales and non promotional sales. In the first vendor information there are no Promotions. The rest of two vendors has got Promotions. In the above BUYER ID logic is, first two letters suppose to come with Division (I have got 19 divisions) I did with fixmap (from PI 7.11) working fine, next 5 letters are Product number, working fine and rest of 10 characters are two dates (Promotion date)_(Hands on Inventory date). I suppose to get like MS0309D_20100920_20101004 (Ex). I am getting correctly, first <OUTPUT> tag hasn't got values so I am getting <null>.
On the target side I need 6 Vendor promotion tags based on 2nd vendor has got 3 promotions and 3rd has got 3 promotions (which is header node), these are all working fine. Now I need to populate BUYER ID from source to these 6 target, the first blank value is going into second vendor first promotional tag, which is not correct.
I don't know wheter I explained properly or not !! Any inputs based on this please.
Many Thanks for your clarification.
Regards
San
Do few more changes and I hope this time it will work..
1. Remove the SplitByValue (which is before just equalS function) because this is the place where <null> is coming into picture. Even I don't think you need SplitByValue at that place in your mapping.
2. Use MapWithDefault to the <OUTPUT> fields so that when they are not coming they must be mapped with some empty/default values.
3. You have to again use the CollapseContext just after the UDF output and then SplitByValue(each value).
e.g.
---CollapseContext -->UDF--->CollapseContext-->SplitByVaue(each value)--->BuyerID
Sarvesh,
You are right, if I take Spiltvalue(Value) change with CollapseContext, it works straight away, no need with UDF too. But the business logic is, I need 6 promotional codes. from 2 <OUTPUT> tags, 2nd and 3rd. Each vendor has got 3 product promotions on 3 diffrent dates,
Vendor 2 has got
one promotion on 20100703,
one promotion on 20100730,
one promotion on 20100809 and 20100723.
That means if one Vendor has promotions on the same date (20100723) those all are comes under one promotion code, the rest of two promotions on two different dates. I sorted dates wise the first context comes with 20100723, second context comes with 20100730 and third one 20100809. The same way 3rd <output> i mean another vendor got 3 more promotions. If I use collapse context, it picks one from 2nd <OUTPUT> and one from 3rd <OUTPUT>.
This is the problem
Your valuable inputs please !!
Regards
San
Hi Sarvesh,
Problem Solved. Please have a look the way I have changed, after your input. You are really talented.
http://img716.imageshack.us/img716/5464/workingfine.jpg
Points alloted
Many Many thanks
Regards
San
Hi Sarvesh,
One more last clarification. I have got one more field called quantity. In 2nd <OUTPUT> and 3rd<OUTPUT> (2nd and 3rd Vendors) has got 6 promotions as mentioned earlier. I have sorted based on promotion date. how to get respective quanties on Target side?
I hope it is nothing for you, could you please!!
Regards
San
Good you were able to solve your problem.
Now about quantity.. What exactly is the problem which you are facing here... can you show is via screen shot.
I guess the sorting is not correct and because of that entries are not coming correctly? If this is the case then you have to use the SortByKey function..
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.