on 05-22-2011 2:13 PM
Hi XI gurus,
I am not an expert with JAVA programming so I'm having this problem regarding the UDF that I need to create. I need to group transactions according to 2 different fields. For example:
Source
Material Price Date
Cotton 1.00 02-28-11
Wood 5.50 01-08-11
Metal 10.0 01-25-11
Cotton 1.00 01-25-11
Wood 5.50 01-25-11
I need to group the transactions that have equal Material and Price.
Output should be:
Idoc1
Cotton 1.0 02-28-11
Cotton 1.0 01-25-11
Idoc2
Wood 5.50 01-08-11
Wood 5.50 01-25-11
Idoc3
Metal 10.0 01-25-11
Is this possible via UDF?
Any help would be greatly appreciated. Thanks!
First you have to write logic for IDoc segment like below.
material>removecontext->sort>splitby value(valuechange)->collapsecontect---->IDoc.
This logic will genarate one IDoc same material,like multiple IDocs for Multiple different materials.
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
material>removecontext->sort>splitby value(valuechange)->collapsecontect---->IDoc is not working
if i check display queue, yes the output is correct. cotton cotton wood wood metal.
but when i'm using the test tab, the order of the idoc is still the same. cotton wood metal cotton wood.
i need to sort the whole idoc, not just the value of the material.
Hi
For the child fields use this function
valueKeyQueue - should be material
valueQueue - should be for example price or date
valueQueue - this entire structure material>removecontext->sort>splitby value(valuechange)->collapsecontect---->I
don't forget splitByValue after the call to the UDF
public static void findValuesByKeysForSearchKeys(String[] valueKeyQueue, String[] valueQueue, String[] searchKeyQueue, ResultList result) throws StreamTransformationException{
for (int i = 0; i < searchKeyQueue.length; i++) {
// Is the current entry a context change?
if (searchKeyQueue<i>.equals(ResultList.CC)) {
// add the context change itself to the result queue
result.addValue(searchKeyQueue<i>);
} else {
// find the value in the valueQueue
boolean found = false;
int j = 0;
while (j < valueKeyQueue.length && !found) {
if (valueKeyQueue[j].equals(searchKeyQueue<i>)) {
found = true;
if (j<valueQueue.length)
result.addValue(valueQueue[j]);
else
result.addValue("");
} else {
j++;
}
}
if (!found) {
result.addValue("");
}
}
}
}
you can use standard function to achieve this.
examples field ---> removecontext --> sort ---> splitbyvalue(value change) -> idoc1 like that.
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.