Solved

The special variable 'Formula' must be assigned a value within the formula

Posted on 2004-11-16
2,706 Views
Greetings...I'm new to crystal and trying to execute the following code to color a textbox, but I get "The special variable 'Formula' must be assigned a value within the formula". What can I do to resolve this?

Scott

If {Total}  <  ({Average}/2) Then
crRed
ElseIf {Total}  >=  ({Average}/2) And {Total}  <  {Average} Then
crYellow
ElseIf {Total}  >=  {Average} Then
crGreen
End If
0
Question by:rsanglim

Author Comment

sorry...v!0 connected to MS SQL 7.0 on Win2k
0

LVL 13

Accepted Solution

If you're using Basic syntax in your formulas, you have to explicitly state 'Formula = x':

If {Total}  <  ({Average}/2) Then
Formula = crRed
ElseIf {Total}  >=  ({Average}/2) And {Total}  <  {Average} Then
Formula = crYellow
ElseIf {Total}  >=  {Average} Then
Formula = crGreen
End If

-dave
0

LVL 28

Expert Comment

You must have the syntax set to Basic in the drop down in the upper right of the formula workshop.
Change that drop down to Crystal syntax and that should clear up that error.
0

Author Comment

Thanks, Dave...that looks like it got it...appreciate the quick response!
0

Author Comment

I was using the Basic syntax, but missed explicitly stating the formula.
0

LVL 13

Expert Comment

-dave
0

LVL 1

Expert Comment

If I switch to Basic Syntax and type "Formula = {crBodyText}

the result is "This field name is not known." yet I am pretty sure this field (crBodyText) does exist in the report!
0

LVL 1

Expert Comment

Sorry - posted to wrong question - PLEASE IGNORE!!    :D
0

Featured Post

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…