Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Statement Required Here

Posted on 2011-03-17
5
419 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

837 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