Skip to Content
0
Former Member
May 27, 2008 at 01:21 PM

UDF problem with Constant parameter

11 Views

Hi guys,

i have a UDF, which used for counting of textlines in an order depending on the language.

there global class Counter with a int and for each language a Counter instance will be created.

therefore the UDF gets 3 input parameters.

If the messages has only 1 order_line the mapping is fine, otherwise the counting is corrupt.

No line count value is created.

I determined following ...

1. If the 3 parameters of the UDF are Constants, the mapping fails.

2. If it gets a list of values in

param queue

e.g. the line number the mapping works.

I tried to get the error using the MappingTrace, but it seems that in the first situation the mapping is not conducted, because there is at least no trace message.

the mapping have to work for constants as well as a list of values (param queue)

is there a special behaviour of constants?

here is the code of the UDF

/**
	 * This method is used to count the textlines according to one language.
	 * 
	 * @param a
	 *            If <code>a</code> is true the line have to be recognized by
	 *            the counter, otherwise the line will be ignored.
	 * @param queue
	 *            queue of textlines which determines how many lines have to be
	 *            created
	 * @param language
	 *            specifies the language, if there isn`t a counter for this
	 *            language yet, a new counter will be created
	 * @param result
	 * @param container
	 */

MappingTrace trace;
		trace = container.getTrace();
		Counter c = (Counter) mCounters.get(language[0]);
		if (c == null) {
			c = new Counter();
			mCounters.put(language[0], c);
		}
		trace.addInfo("length 1st " + a.length);
		trace.addInfo("length 2st " + queue.length);
		trace.addInfo("length 3st " + language.length);
		if (a.length != 0 && queue.length != 0 && language.length != 0) {
			if (a[0].equals("true")) {
				for (int i = 0; i < queue.length; i++) {
					result.addValue(Integer.toString(c.getNextValue()));
					trace.addInfo("value of Counter " + language[0] + " " + c.counter);
				}
			}
		}

I hope the issue is understandable.

thanks for your help.

kind regards

Jochen