cancel
Showing results for 
Search instead for 
Did you mean: 

Its a calulation -- Number of Hours to Unload

Former Member
0 Kudos

HI Gurus,

i have requirement i need to write a UDF for caliculation Time .. through graphical mapping i done..its a perfomance issue///. it is necessary to go for UDFs.

Its a calulation -- Number of Hours to Unload

((NTANZ) where QUALF=006) - ((NTANZ)where QUALF=007)

result is this Format

HHMM

Its a calulation -- Number of Hours to Unload

let me know any related links and related UDFs ...

thanks in advance

Edited by: mahesh1331 on Jun 27, 2010 11:37 AM

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Mahesh i think this udf is use full your requirement

String ret=null;

try{

DateFormat sdf1=new SimpleDateFormat("hhmmss");

Date p=sdf1.parse(var1);

Date p2=sdf1.parse(var2);

long h=Math.abs(p.getHours()-p2.getHours());

long m=Math.abs(p.getMinutes()-p2.getMinutes());

long s=p2.getSeconds()-p.getSeconds();

String hh=String.valueOf(h);

String ss=String.valueOf(s);

String mm=String.valueOf(m);

if(hh.length()==1)

hh="0"+hh;

if(mm.length()==1)

mm="0"+mm;

if(ss.length()==1)

ss="0"+ss;

String con=hh.concat(mm).concat(ss);

ret=con;

}catch(ParseException pe){

}

return ret;

Answers (1)

Answers (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

If you achieved your requirement using Graphical Mapping then no need to go for UDF, using UDFs not adviceble when you can achive your requirement using Graphical Mapping.

Graphical Mapping will not give any performace issues,so you can go ahead with current mapping logic,no need to go for UDF.

Regards,

Raj

Former Member
0 Kudos

HI Raj.

"using UDFs not adviceble when you can achive your requirement using Graphical Mapping." i agree..

but i want to go for UDFs... let me know if u any logic on this calculation .

thanks in advance

Former Member
0 Kudos

Hi Mahesh,

PFA the link :http://en.allexperts.com/q/Java-1046/calculate-show-remaining-time.htm

Hope it might give you the logic to make the UDF for the mapping.

Regards

Ravi Anand