1 Reply Latest reply: Mar 21, 2014 11:40 AM by Denes Kubicek RSS

    Dynamic action - Get the difference between two dates

    IdrisYS

      Dear Sir

       

      I'm having a little trouble getting a Dynamic action to work for date . I'm trying to get the time difference between two dates

      I have Two date pickers fields :P6_F_DATE &  :P6_T_DATE (with date format 'dd/mm/yyyy' and default values as sysdate ) and one number item P6_DATE_DIFF


      IF I Set the default value of P6_DATE_DIFF with default value type : PL/SQL FUNCTION BODY


      declare

      a number;

      a:=to_date(:P6_T_DATE,'DD/MM/YYYY') - to_date(:P6_F_DATE,'DD/MM/YYYY') ;

      return(a);

      end;


      I get the correct result =0


      But when P6_T_DATE values changes i need to recalculate so i have make Dynamic action  on P6_T_DATE

      WITH event=change , item=P6_T_DATE , ACTION = set value ,set_type= PL/SQL FUNCTION BODY ,affected element = P6_DATE_DIFF


      declare

      a number;

      a:=to_date(:P6_T_DATE,'DD/MM/YYYY') - to_date(:P6_F_DATE,'DD/MM/YYYY') ;

      return(a);

      end;


      I don't get any result  I GET null values ....if i change P6_T_DATE to sysdate i get results as 0

      but if i refer as :P6_T_DATE it does not takes value of :P6_T_DATE


      Y is the same code working fine in default value of P6_DATE_DIFF and is taking values of P6_F_DATE AND P6_T_DATE

      and in dymaic action it is not taking the item values of P6_F_DATE AND P6_T_DATE


      Pls Advice ..Also if there any demo package application example pls refe to me


      Thanks and regards


      Idris