Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the function FORMULA in a formula. 1

Status
Not open for further replies.

chiplarsen

IS-IT--Management
Jan 8, 2004
87
US
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.
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
Does anyone have any idea why this is or if it can be taken out. Thank you




 
When you paste it in, go up above and change the syntax to BASIC, it isn't recognized because you have it set to crystal syntax.

-k
 
I just figured that out....Thank you synapsevampire. I have always been able to keep my reports simple and use Crystal Syntax. I have never used Basic Syntax. I should be able to expand on my formulas now.

Thank you again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top