on 03-08-2016 8:22 AM
Hi Experts,
could please give suggestion for me to creating the mapping.below requirement.
when ever first unique value in the context it should increment value is =10, and the duplicate values(repeted values) increment by 900001,900002.
in the context can any one pls help me how to reslove this issue.
Thanks
Narendra
Narendra,
Please create "All values of a Context" UDF. If required use removeContext
public void udf_getCount(String[] Id, ResultList Record_out, Container container) throws StreamTransformationException {
String previous = "--";
int value = 900001;
for (int i = 0; i < Id.length; i++) {
if (previous.equals(Id[i])) {
Record_out.addValue(value++);
} else {
Record_out.addValue(Id[i]);
}
previous = Id[i];
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Narendran,
I adjusted the code from raghu, you can use below UDF.
public void udf_getCount(String[] Id, ResultList Record_out, Container container) throws StreamTransformationException {
String previous = "--";
int secondValue = 900001;
int firstValue = 0;
for (int i = 0; i < Id.length; i++) {
if (previous.equals(Id[i])) {
Record_out.addValue(secondValue++);
} else {
Record_out.addValue(firstValue += 10);
}
previous = Id[i];
}
}
Regards,
Praveen.
Hi Narendran,
Can you please provide some sample input/output to understand your requirement.
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anupam,
below out put expected from target side.please help me for suggestions.
unique value =10
duplicate value=900001
duplicate value=900002
duplicate value=900003
unique value =20
duplicate value=900004
duplicate value=900005
duplicate value=900006
unique value =30
duplicate value=900007
duplicate value=900008
Thanks
Narendra
Hi Narendran,
You can use the count function, check this wiki: Count of Records - &#39;Count on the easiest way through&#39; - Process Integration - SCN Wi...
If you want to increment a counter between different mapping, you would need more development: Count of Records - &#39;Count on the easiest way through&#39; - Process Integration - SCN Wi...
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.