Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Create Global Function
csasaki
Hello
I have some code that I'm using many times, and I want to know if I can create like a global function (like the ones from Birt).
For example I Have this code :
//***************************************************************************
// Inputs will be Date1 and Date 2
var Year1= BirtDateTime.year(Date1);
var Mes1 =BirtDateTime.month(Date1);
var day1 = BirtDateTime.day(Date1);
var fecha1 = Year1 + "-" + Mes1 + "-" + day1 +" 18:00:00" ;
var minutos_dia1 = BirtDateTime.diffMinute(Date1,fecha1);
var Year2= BirtDateTime.year(Date2);
var Mes2 =BirtDateTime.month(Date2);
var day2 = BirtDateTime.day(Date2);
var fecha2 = Year2 + "-" + Mes2 + "-" + day2 +" 09:00:00" ;
var minutos_dia2 = BirtDateTime.diffMinute(fecha2,Date2);
var minutos_total = dias_completos*60*9 + minutos_dia1 + minutos_dia2;
output = minutos_total;
// Output will be the variable output.
//************************************************************************************
I want to create like a function :
GetTotalMinutes(DateParameter1,DateParameter2) , and that it returns me the value output.
Where do i have to define it? And is it possible to use it with Rational Team Concert?
THanks !
Find more posts tagged with
Comments
mwilliams
You could always just create an external js file and use it as a resource in your reports. To create a function that will show up in the palette, you'd need to create a function plug-in.
http://birtworld.blogspot.com/2008/09/birt-231-adding-functions-to-expression.html