Skip to Content
avatar image
Former Member

UDF Function

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..

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Sep 11, 2008 at 07:14 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 11, 2008 at 07:16 AM

    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");

    }

    }

    :

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 11, 2008 at 07:25 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 11, 2008 at 07:32 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 11, 2008 at 10:08 AM

    Thank you

    Add comment
    10|10000 characters needed characters exceeded