cancel
Showing results for 
Search instead for 
Did you mean: 

UDF Function

Former Member
0 Kudos

Hi,

my scenario is i am passing the variable which holds the current date in this format yyyy/dd/mm as argument in userdefined function and i am checking for a codition if the condition is not satisfied then in else part it need to print the

arugument date in yy/mm format..

plz help by providing the code for getting the date format like as mentioned above..

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Thank you

Former Member
0 Kudos

U can do this with simple UDF

Assume a as the current date in format yyyy/dd/mm


public String check_condition(String a,Container container)
{
String b;
if(condition)
 {
     //steps to be performed
 }
else 
{
 b = a.substring(2,4) + "/" + a.substring(8,10);
 return b;
}

}

Edited by: malini balasubramaniam on Sep 11, 2008 9:40 AM

Former Member
0 Kudos

Hi,

couldn't you return the boolean value of your udf to a standard if-function.

UDF -> if true

then: currentDate

else: currentDate -> Transformation(yyyy/dd/mm, yy/mm)

Regards

Patrick

Former Member
0 Kudos

You can customize the UDF..This UDF i wrote to check a condition....

the code is input value a

for(i=0;i<a.length;i++)

{

if(a.equals("A"))

{

result.addValue("Valid Value");

}

else

{

result.addValue("Not a Valid Value");

}

}

:

Former Member
0 Kudos

HI

the UDF

java.util.Date d = new java.util.Date();

java.text.SimpleDateFormat f

= new java.text.SimpleDateFormat("yyyy-dd-MM");

return f.format(d) ;

else ......

yy/mm format..

Regard's

Chetan Ahuja