Solved

Statement Required Here

Posted on 2011-03-17
5
417 Views
Last Modified: 2012-05-11
I have developed a report that has multiple problem codes that I want to translate into a phrase for a customer to understand what took place.  I wrote the forumula in Basic Syntax but keep getting the error message a Statement is required here after the Then.  Here is my formula:

If {SP_WO_OpenCLose_VW.wd_p_id} ="PEA" Then "Electronics-Not Printing"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEB" Then "No Print Go"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEC" Then "No Paper"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PED" Then "No Power"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEE" Then "Phasing Error"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEF" Then "No Data Entry"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEG" Then "Electronics Overheating"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEJ" Then "In Reset"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEQ" Then "Communication Error"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PMS" Then "Preventative Maintenance"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEO" Then "Boot Startup Failure"
Else "No Error Captured"
End If


What am i missing?
0
Comment
Question by:jefjar
  • 3
  • 2
5 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 35156733
2 ways to fix this

1.  Use Crystal syntax and change the Esle If to EsleIf

2 Use Basic syntax and change it to

If {SP_WO_OpenCLose_VW.wd_p_id} ="PEA" Then Formula = "Electronics-Not Printing"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEB" Then Formula = "No Print Go"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEC" Then Formula = "No Paper"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PED" Then Formula = "No Power"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEE" Then Formula = "Phasing Error"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEF" Then Formula = "No Data Entry"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEG" Then Formula = "Electronics Overheating"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEJ" Then Formula = "In Reset"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEQ" Then Formula = "Communication Error"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PMS" Then Formula = "Preventative Maintenance"
Else if {SP_WO_OpenCLose_VW.wd_p_id} ="PEO" Then Formula = "Boot Startup Failure"
Else Formula = "No Error Captured"
End If

mlmcc
0
 

Author Comment

by:jefjar
ID: 35156856
Thanks for that but now everything after the first If statement is highlighted and I get the error message "The remainig text does not appear to be part of the formula."  If checked the statement and made sure that I am in basic syntax.  What am I missing?
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 35159206
Sorry had the 2 backwards.
If {qryHoursWorked.CompanyName} = "123" then
   formula = "123"
Elseif {qryHoursWorked.CompanyName} = "321" then
   formula = "321"
Else
      formula = "432"
End if

Your orignal works in Crystal syntax without the End If

Change the one I gave to use ElseIf

mlmcc
0
 

Author Closing Comment

by:jefjar
ID: 35160121
Trying to keep me on my toes huh?  Thanks for the solution it worked.  One of these days Ill get my syntaxes worked out.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35160918
I always use Crystal so when I try the basic I get things backwards.

mlmcc
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question