cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in UDF

Former Member
0 Kudos

Is it possible to add multiple lines in result.addValue()???

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

What exactly you want to acheive?

Thanks

Farooq

Former Member
0 Kudos

consider for example

if (t == 1)

result.addValue ("Invalid time");

if (d == 1)

result.addValue("Invalid date" );

if (f == 1)

result.addValue("Invalid file type");

if (f == 1 || d == 1 || t == 1 )

gc.setParameter("STATUS" , "1");

when i do this the result contains the value of the first satisfied if condition. In my UDF more than one condition will be satisfied.In that case i have to cocatenate the result of all the satisfyings if's to output.How to do this?

former_member194786
Active Contributor
0 Kudos

Hi Malini,

Directly using the result.addValue() should help in that case i guess. It will add multiple values to the output.Are you getting error in that?

Regards,

Sanjeev.

Former Member
0 Kudos

Hi Sanjeev.

I cant get you.

Former Member
0 Kudos

no need for UDF.

You can do this with standard if, concat, constant and equals functions.

e.g. if t equals constant[1] then result = constant[[Invalid time]]. Then concat this to result of d == 1 condition and to that of f == 1 condition and so on.

Finally you have concatenated output of all the conditions. You can use delimitors like comma to separate the concatenated output.

Regards,

Riyaz

Edited by: Riyaz on Jul 3, 2008 4:35 PM

Former Member
0 Kudos

t,f and d which i have mentioned are global variables set as result of various udf's. They are not elements.

Former Member
0 Kudos

in that case, try storing the results of all if conditions in a temporary string (in concatenated form). and then pass this string as a parameter to result.addValue() function.

Hope this helps.

Regards,

Riyaz

Former Member
0 Kudos

Thanks Riyaz

Former Member
0 Kudos

Hi,

You can add as many lines you want.

Note that advanced UDF gets executed only once per context or queue while a simple UDF is called for every occurrence of the source element. addValue method is only supported in in advanced UDF i.e. when working with entire queues or contexts.

Regards,

Riyaz