Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

Crystal Reports - Formula - comparison of values

I need to build a formula that has 4 potential results. I have it working with 3 but can't figure the 4th piece out. Here is the formula from mlmcc

Local NumberVar Q408Q109;
Local NumberVar Q208Q308;

Q408Q109 := ({#Running Q408 and Q109});
Q208Q308 := ({#Running 2Q - 3Q Total});

If Q408Q109  > Q208Q308  then
    "UP"
else if (Q408Q109 = 0) and (Q208Q308 = 0)  then
    "INACTIVE"
else
    "DOWN"

After a closer look at the data, I need a 4th variable. Here's an example of the data that would be represented;
1) UP  - Up from last time period (2 cases in Jan and 3 cases in Feb)
2) Down  - Down from last time period (3 cases in Jan and 2 cases in Feb)
3) Inactive - Shows no activity in either time period being compared (i.e. Zero cases in Jan and Zero cases in Feb)
4) FLAT - Shows activity in both time periods but each is equal to the other (i.e., 3 cases in Jan and 3 cases in Feb) so NOT INACTIVE but FLAT

I tried something like this to read if (Q408Q109 = Q208Q308) and = 0, then FLAT. Here's my attempt at the formula:
else if ((Q408Q109 = Q208Q308) <> 0)  then
    "FLAT"
but I get an error indicating that Crystal is expecting a boolean in pace of the "0" which I understand but I don't know how to fix to get the result I am after.

Any help would be GREAT! Thanks in Advance!

0
dsabine
Asked:
dsabine
1 Solution
 
mlmccCommented:
Local NumberVar Q408Q109;
Local NumberVar Q208Q308;

Q408Q109 := ({#Running Q408 and Q109});
Q208Q308 := ({#Running 2Q - 3Q Total});

If Q408Q109  > Q208Q308  then
    "UP"
else if (Q408Q109 = 0) and (Q208Q308 = 0)  then
    "INACTIVE"
else if Q408Q109  < Q208Q308  
    "DOWN"
else
      "FLAT"

mlmcc
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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