This topic is locked

Beforeadd After Server Change

5/21/2013 12:15:59 PM
ASPRunnerPro General questions
F
Flavio author

Hello, i used to have this script as beforeadd function.

I have changed my provider server and taken all the files on the new one, now everything works BUT this script.
If i remove the ignore at the response.write instructions, i can see the proper numbers in the page. But the script wont write the result in the proper field "Hrs_worked".
All i have changed from when it was working, as said, is that i have taken all the files on another server on another provider.
Thank you in advance, Flavio.
<% Function BeforeAdd(dict) intStart = Cdate(dict("Shift_Start")) intEnd

= Cdate(dict("Shift_End"))
session("Hrs_Worked") = FormatDateTime(intEnd - intStart, 4)
intTimeDiff = Session("Hrs_worked")
'response.write(intTimeDiff)
intFractional =

(Cint(Mid(intTimeDiff,(instr(1,intTimeDiff,".")+1),len(intTimeDiff))) /

60 * 100)
intHours = Left(intTimeDiff,2)
'response.write(intHours)
if intFractional = 0 and

((datediff("n",dict("Shift_Start"),dict("Shift_End"))) > 0 ) then
dict("Hrs_Worked") =

(datediff("n",dict("Shift_Start"),dict("Shift_End"))) / 60
else
dict("Hrs_Worked") = (0 -

((datediff("n",dict("Shift_Start"),dict("Shift_End"))) / 60))
end if
if intFractional <> 0 then
dict("Hrs_Worked") = intHours +

((Mid(intFractional,(instr(1,intFractional,",")+1),len(intFractional)))

/ 100)
end if
if ((datediff("n",dict("Shift_Start"),dict("Shift_End"))) < 0 ) then
dict("Hrs_Worked") = (0 - dict("Hrs_Worked"))
end if
if dict("Hrs_Worked") < 0 then
%>

<script LANGUAGE="Javascript"> alert("ATTENZIONE!!! La data/ora di Fine

Turno Ë ANTECEDENTE alla data/ora di Inizio Turno!!!! Correggi,

VOLONTARIO!") </SCRIPT> <%
end if
BeforeAdd = True
' set BeforeEdit to True if you like to proceed with editing this record

' set it to False in other case
end function

F
Flavio author 5/27/2013
Sergey Kornilov admin 5/27/2013

Flavio,
it doesn't work this way. If you want to output something on the page using event like BeforeAdd or AfterAdd (recommended) use the following code:

flush_output

Response.Write "something"