on ‎2007 Oct 23 12:25 PM
Hello,
i have the following source and destination structure:
<src_struct> (0-n)
<qualifier>
<value>
</src_struct>
<dest_struct> (0-n)
<counter>
<qualifier>
<value>
</src_struct>
only those dest structures have to be created where <qualifier="XX">.
Thus my mapping on structure level looks like:
if <qualifier> equalS "XX" createIf --> <dest_struct>
This works fine.
But additionally i need to increment <counter> in the dest_struct. I.e., when i have 10 src_struct where 5 of them has <qualifier="XX"> i need 5 dest_struct with counter 1 to 5.
I tried this with a UDF which has just a constant as input:
"MY_COUNTER" --> UDF:getNextCounter --> <counter>
This argument is the name under which the last counter was saved in the global container. My expectation was that for each time the field <counter> will be created, my UDF reads the las counter, increments it, saves it back to the container and returns the result.
but the bahavior is different:
For example:
if src_structures 6-10 have <qualifier>="XX" my UFD returns 6-10 in sequnce instead
of 1-5. The shows me, that my UDF runs 10 times even though just 5 dest_struct are created.
What do i wrong?
Her my UDF:
GlobalContainer gc = container.getGlobalContainer();
String counter = new String();
counter = (String) gc.getParameter(MY_COUNTER);
if(counter==null) {
counter = "1";
gc.setParameter(MY_COUNTER,counter);
return(counter);
}
Integer i_counter = new Integer(counter);
int i = i_counter.intValue() + 1;
Integer I = new Integer(i);
counter = I.toString();
gc.setParameter(ID_TYPE,counter);
return(counter);
Request clarification before answering.
Hi
Check the condition on qualifier
i.e. if <qualifier> == "XX"
then only increment the counter
this should work
regards
Sheetal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.