• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 433
  • Last Modified:

Statement Required Here

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
jefjar
Asked:
jefjar
  • 3
  • 2
1 Solution
 
mlmccCommented:
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
 
jefjarAuthor Commented:
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
 
mlmccCommented:
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
 
jefjarAuthor Commented:
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
 
mlmccCommented:
I always use Crystal so when I try the basic I get things backwards.

mlmcc
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now