phantomwalker
Technical User
hi,
Can I still buy\download power builder V7.
I need it to build a global function and add it to my .pbd or .pbl. associated to an aplication (ServiceAliance)
I have made the User Defined function in Sql 2000 but my application does not see it. (See UDF below)
Also does any one know a program to display the code of Global function that are stored in .pbd file. I tried PBBrowser but it does not display the code.
Kind Regards,
Eric
++++++
create function dbo.fn_get_project_eta(@demand int, @assigned datetime)
returns datetime
as
begin
Declare @hrs int
Declare @min int
Declare @sec int
Declare @response_time int
Declare @weekday int
Declare @dayofyear int
Declare @current datetime
Declare @holiday varchar (1)
Declare @start_date datetime
Declare @start_time datetime
Declare @end_time datetime
Declare @day_remainder int
Declare @response_carry int
Declare @work_minutes int
Declare @ETA datetime
set @response_time = (select (btas_response_time *60) from demand_labor where demand_id = @demand)
set @start_date = CONVERT(varchar(8), @assigned, 112)
set @current = @start_date
set @start_time = (select dateadd(hh,8,@start_date))
set @end_time = (select dateadd(hh,17,@start_date))
set @work_minutes = 480
set @response_carry = @response_time
while @response_carry >0
begin
set @day_remainder = (Select case when @current = @start_date
then datediff(minute,@assigned,@end_time)
when NOT(@current = @start_date)
then 480
else 0
end)
set @dayofyear = (select datepart(dayofyear,@current))
set @weekday = (select datepart(weekday,@current))
set @holiday = (select case when (SELECT datepart(dayofyear,@current)) in
(select datepart(dayofyear,holiday_date) from holiday where is_all_nodes = 'Y')
then 'Y'
else 'N'
end)
set @start_time = (select dateadd(hh,8,@current))
set @end_time = (select dateadd(hh,17,@current))
set @eta =(select case when @current = @start_date and @response_carry < @day_remainder
then dateadd(minute,@response_carry,@assigned)
when NOT(@current = @start_date) and @response_carry < @day_remainder
then dateadd(minute,@response_carry,@start_time)
else 0
end)
set @response_carry = (select case
when (@weekday >1 and @weekday < 7 and @holiday ='N') and @current = @start_date and @response_carry < @day_remainder
then 0
when (@weekday >1 and @weekday < 7 and @holiday ='N') and @current = @start_date and @response_carry > @day_remainder
then @response_carry - @day_remainder
when (not(@weekday >1 and @weekday < 7) or @holiday ='Y')
then @response_carry
when (@weekday >1 and @weekday < 7 and @holiday ='N') and NOT(@current = @start_date) and @response_carry < @day_remainder
then 0
when (@weekday >1 and @weekday < 7 and @holiday ='N') and NOT(@current = @start_date) and @response_carry > @day_remainder
then @response_carry - @day_remainder
else 0
end)
Set @current = (select DATEADD ( day , 1, @current ))
end
return @ETA
end
Can I still buy\download power builder V7.
I need it to build a global function and add it to my .pbd or .pbl. associated to an aplication (ServiceAliance)
I have made the User Defined function in Sql 2000 but my application does not see it. (See UDF below)
Also does any one know a program to display the code of Global function that are stored in .pbd file. I tried PBBrowser but it does not display the code.
Kind Regards,
Eric
++++++
create function dbo.fn_get_project_eta(@demand int, @assigned datetime)
returns datetime
as
begin
Declare @hrs int
Declare @min int
Declare @sec int
Declare @response_time int
Declare @weekday int
Declare @dayofyear int
Declare @current datetime
Declare @holiday varchar (1)
Declare @start_date datetime
Declare @start_time datetime
Declare @end_time datetime
Declare @day_remainder int
Declare @response_carry int
Declare @work_minutes int
Declare @ETA datetime
set @response_time = (select (btas_response_time *60) from demand_labor where demand_id = @demand)
set @start_date = CONVERT(varchar(8), @assigned, 112)
set @current = @start_date
set @start_time = (select dateadd(hh,8,@start_date))
set @end_time = (select dateadd(hh,17,@start_date))
set @work_minutes = 480
set @response_carry = @response_time
while @response_carry >0
begin
set @day_remainder = (Select case when @current = @start_date
then datediff(minute,@assigned,@end_time)
when NOT(@current = @start_date)
then 480
else 0
end)
set @dayofyear = (select datepart(dayofyear,@current))
set @weekday = (select datepart(weekday,@current))
set @holiday = (select case when (SELECT datepart(dayofyear,@current)) in
(select datepart(dayofyear,holiday_date) from holiday where is_all_nodes = 'Y')
then 'Y'
else 'N'
end)
set @start_time = (select dateadd(hh,8,@current))
set @end_time = (select dateadd(hh,17,@current))
set @eta =(select case when @current = @start_date and @response_carry < @day_remainder
then dateadd(minute,@response_carry,@assigned)
when NOT(@current = @start_date) and @response_carry < @day_remainder
then dateadd(minute,@response_carry,@start_time)
else 0
end)
set @response_carry = (select case
when (@weekday >1 and @weekday < 7 and @holiday ='N') and @current = @start_date and @response_carry < @day_remainder
then 0
when (@weekday >1 and @weekday < 7 and @holiday ='N') and @current = @start_date and @response_carry > @day_remainder
then @response_carry - @day_remainder
when (not(@weekday >1 and @weekday < 7) or @holiday ='Y')
then @response_carry
when (@weekday >1 and @weekday < 7 and @holiday ='N') and NOT(@current = @start_date) and @response_carry < @day_remainder
then 0
when (@weekday >1 and @weekday < 7 and @holiday ='N') and NOT(@current = @start_date) and @response_carry > @day_remainder
then @response_carry - @day_remainder
else 0
end)
Set @current = (select DATEADD ( day , 1, @current ))
end
return @ETA
end