Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » IF-Else formula
IF-Else formula [message #644138] Thu, 09 December 2010 16:22
bapo  is currently offline bapo Friend
Messages: 1
Registered: December 2010
Junior Member
Hello, I am new to Birt, and need some help.

I have a problem with IF-Else formula. At the momement I use this formula...

a=value (minutes)

if (a == 0) {
s = "00:00h"
} else {
s="";
partoftheday = parseInt(a/480,0);
if (partoftheday != 0) {
s+=partoftheday;
loc = reportContext.getLocale();
if (BirtComp.like(loc, "de_%"))
s+="d ";
else
s+="a ";
}

if (a<0 && partoftheday != 0)
rest =-1 * a % 480;
else
rest = a % 480;

if (rest > 0) {
s+="0"+parseInt(rest/60,0);
if((rest%60)<10)
s+=":0"+(rest%60)+"h";
else
s+=":"+(rest%60)+"h";
} else if (rest < 0) {
s+="-0"+parseInt(-1*rest/60,0);
if((-1*rest%60)<10)
s+=":0"+(-1*rest%60)+"h";
else
s+=":"+(-1*rest%60)+"h";
} else if (rest == 0){
s += "00:00h";
} else {
s += "XX:XXh"
}
}


to get this format "Xd XX:XXh".

And now I want to get this format "XX:XXh". Until now, the requirements were always to convert the hours to days. This meant that a working day (8 hours) resulted in a day and the rest was displayed in hours and minutes. Now it is so that only the hours and minutes should to be displayed
but I donĀ“t know what I have to do.

Maybe someone who can help me.

Thanks in advance.

bapo

[Updated on: Thu, 09 December 2010 16:23]

Report message to a moderator

Previous Topic:Unable to access selected values of a ListBox type parameter
Next Topic:Total.count per group
Goto Forum:
  


Current Time: Sun Nov 23 16:28:34 GMT 2014

Powered by FUDForum. Page generated in 0.02373 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software