Go Premium for a chance to win a PS4. Enter to Win

x
Solved

# Crystal Formula

Posted on 2013-01-16
Medium Priority
454 Views
Hello everybody,
I have the below crystal formula:

if {Billing.CCID}= 'MNGED PER DIEM' or {Billing.CCID}= 'MED A PER DIEM' then

local numbervar billamount := {Billing.BillAmt}
else
if IsNull({Billing.CCID}) then
local numbervar billamount := 0.00;

The formula is displaying the data for medaperdiem or mngedperdiem but the second condition is not getting evaluated.Its not displaying 0.00

0
Question by:Star79
• 2

LVL 44

Accepted Solution

zephyr_hex (Megan) earned 2000 total points
ID: 38784332
Crystal requires the evaluation of null FIRST.

Try this:

local numbervar billamount;  //this declares the local variable
if isnull({Billing.CCID})  then billamount:=0
else if ({Billing.CCID}= 'MNGED PER DIEM' or {Billing.CCID}= 'MED A PER DIEM' ) then
billamount := {Billing.BillAmt};
0

LVL 44

Expert Comment

ID: 38784361
you might want to consider what should happen with billamount if {Billing.CCID} is not null, not 'MNGED PER DIEM' and not 'MED A PER DIEM'.  in other words, make sure you don't need a default value for billamount.  you could do one of the following:

local numbervar billamount:=0;  //this declares the local variable and sets default value to zero
if isnull({Billing.CCID})  then billamount:=0
else if ({Billing.CCID}= 'MNGED PER DIEM' or {Billing.CCID}= 'MED A PER DIEM' ) then
billamount := {Billing.BillAmt};

-------------------
or
------------------
local numbervar billamount;  //this declares the local variable
if isnull({Billing.CCID})  then billamount:=0
else if ({Billing.CCID}= 'MNGED PER DIEM' or {Billing.CCID}= 'MED A PER DIEM' ) then
billamount := {Billing.BillAmt}
else billamount:=0;  //if all else fails, set billamount to 0
0

## Featured Post

Question has a verified solution.

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

Problem Statement In an SAP BI BO Integration project when a BO universe is built on a BEx query, there can be an issue of unit & formatted value objects not getting generated in a BO universe for some key figures. This results in an issue whereb…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…