on 03-30-2011 11:07 PM
Hi Gurus,
I am having a source message like this:
ITEM (1..unbounded)
>SOURCEFIELD (1..1)
Sourcefield is below Item.
In the target side, there is a field called TARGETFIELD (1..unbounded) that needs to be created with next condition:
for each nonrepeteable sourcefield value, one targetfield must be created. For example:
<Item>
<Sourcefield>1</Sourcefield>
</Item>
<Item>
<Sourcefield>1</Sourcefield>
</Item>
<Item>
<Sourcefield>2</Sourcefield>
</Item>
<Item>
<Sourcefield>2</Sourcefield>
</Item>
<Item>
<Sourcefield>3</Sourcefield>
</Item>
In this example, 3 TARGETFIELD must be created, since there are only 3 non repeteable values (1, 2 and 3).
Something important to notice is that values will ALWAYS come sorted.
How can I do this in mapping? Should I develop an UDF? Or can I use PI's common functions?
Thanks!
Edited by: chapa_akd on Mar 31, 2011 12:18 AM
I dont think you need UDF to handle this requirement. Simply use the following node functions in graphical mapping:
Source field > RemoveContext>Sort (not required if you are sure that values will always come sorted)-->SplitbyValue(Value change)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Finally, Samiullah was right and his solution was the right one.
I need to do something new inside that.
Will open a new thread since this is already answered and the other one will be a different (and most difficult) issue.
Thanks everyone!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can use
Source Segment -
>Removecontext--
>Target Segment
and
Source Field--->Removecontext
>Target Field
Thanks and Regards,
Neethu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you all for replies.
Actually, issue is almost solved with Puneet's anwser but there is one concern: the sourcefields got values 1, 2, 2, 2, 2, 3, 4, 5, 6 and 7.
And when targetfield is created, it creates 7 of them (which is CORRECT) but value passed is not 1, 2, 3, 4, 5, 6 and 7; it is 1, 2, 2, 2, 2, 3 and 4.
Is there any way in which I can map corresponding values to that field?
Thanks in advance.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
The mapping will be like this
SourceField - Removecontexts - Sort - SplitByValue( valuec hange)
Regards
Sandeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use SplitByvalue Node function. This function will insert context change with each value or after value change.
You can use after value change in SplitByValue node function.
I don't have PI system handy so I am not able to give you complete graphical maping but you can do with graphical mapping.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.