on 06-27-2010 10:34 AM
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
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;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.