Hi PI/PO Experts,
I have been trying with UDF with no luck, so reaching for your expertise
Requirement is simple : when source has value 1 then target should have value 1 in same context
When source has 1 and below value is 2 which is in separate context then target should have values 1 and 2 in same context and similarly source has 1,2,3 in separate context the target should have 1,2,3 in same context as shown below
Please share an UDF if you have one to achieve the requirement

Request clarification before answering.
Hi!
In order to remove initial context change try to check the index of item being processed. If it's the very first item in the queue (i == 0) - you shouldn' add context change.
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Below code works as expected however i see an extra <null> occur due to which the context is changing, so how do i remove the null with in the code
import com.sap.it.api.mapping.*;
public void cc1(String[] input, Output output, MappingContext context) {
for (int i = 0; i < input.length; i++)
{
if ((input[i].equals("1")) )
{
output.addContextChange();
output.addValue(input[i]);
// result.addValue(ResultList.CC);
}
else {
output.addValue(input[i]);
}
}
}

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thank you for helping here
My code is getting wrong results
I am expecting below code to add context change but getting wrong results
for (int i = 0; i < input.length; i++)
{
if (input[i].equals("1"))
{
result.addValue(input[i]);
result.addContextChange();
}
else {
result.addValue(input[i]);
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
Wouldn't you please provide your UDF code?
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.