chiplarsen
IS-IT--Management
I am using Crystal 10. The database is MSSQL Server.
I have a report that I am modifying. It has a formula that uses the word FORMULA in it. I am trying to copy the formula and reuse it to create another formula. When I copy and paste it, the word FORMULA is not recognized as in the original formula. What is FORMULA used for in this? Is it a valid function? The word FORMULA appears BLUE in the original formula. It does not in the copy.
Below is the original formula.
Does anyone have any idea why this is or if it can be taken out. Thank you
I have a report that I am modifying. It has a formula that uses the word FORMULA in it. I am trying to copy the formula and reuse it to create another formula. When I copy and paste it, the word FORMULA is not recognized as in the original formula. What is FORMULA used for in this? Is it a valid function? The word FORMULA appears BLUE in the original formula. It does not in the copy.
Below is the original formula.
Code:
Dim start_time As Time
Dim stop_time As Time
Dim start_shift As Time
Dim stop_shift As Time
Dim start_dateA As Date
Dim stop_dateA As Date
Dim start_dateB As Date
Dim stop_dateB As Date
formula = 0
start_dateA = {?frmdt}
stop_dateA = {?todt}
start_dateB = CDate({casepostop.pat_in_datetime})
stop_dateB = CDate({casepostop.pat_out_datetime})
start_time = CTime({casepostop.pat_in_datetime})
stop_time = CTime({casepostop.pat_out_datetime})
start_shift = {?start_shift1}
stop_shift = {?stop_shift1}
if isNull({casepostop.pat_in_datetime}) or isNull({casemain.actcase_stop_datetime}) then
formula = 0
else
if start_dateB in start_dateA to stop_dateA then
if ({@midnight_shift1} = 1) then
if (start_time in start_shift to CTime(23,59,59)) or (start_time in CTime(00,00,00) to stop_shift) then
formula = DateDiff ("n",{casepostop.pat_in_datetime}, {casepostop.pat_out_datetime})
end if
else
if start_time in start_shift to stop_shift then
if dayofweek({casepostop.pat_in_datetime})<> 7 and dayofweek({casepostop.pat_in_datetime})<> 1 then
formula = DateDiff ("n", {casepostop.pat_in_datetime},{casepostop.pat_out_datetime})
end if
end if
end if
end if
end if