Solved

IF THEN LOOP

Posted on 2014-04-02
2
176 Views
Last Modified: 2014-04-02
Hello,
I have below if loop in crystal formula:

if {Non_FormularyDrugReporttest;1.Action}= 'D' then
{Non_FormularyDrugReporttest;1.Qty}
ELSE  
if (isnull ({Non_FormularyDrugReporttest;1.Action})= true 
 then
{Non_FormularyDrugReporttest;1.Qty}  - {Non_FormularyDrugReporttest;1.creditqty}
ELSE
if {Non_FormularyDrugReporttest;1.Action} = 'R' then

{Non_FormularyDrugReporttest;1.Qty}  - {Non_FormularyDrugReporttest;1.creditqty}

Open in new window


Iam getting error saying ')' is missing not sure where Iam missing.
Thanks.
0
Comment
Question by:Star79
[X]
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
2 Comments
 
LVL 22

Expert Comment

by:plusone3055
ID: 39972691
if {Non_FormularyDrugReporttest;1.Action}= 'D' then
{Non_FormularyDrugReporttest;1.Qty}
ELSE  
if (isnull ({Non_FormularyDrugReporttest;1.Action})= true )
 then
{Non_FormularyDrugReporttest;1.Qty}  - {Non_FormularyDrugReporttest;1.creditqty}
ELSE
if {Non_FormularyDrugReporttest;1.Action} = 'R' then

{Non_FormularyDrugReporttest;1.Qty}  - {Non_FormularyDrugReporttest;1.creditqty}
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 500 total points
ID: 39972788
You need to change the formula to test for NULL first.  Crystal errors out when it uses a NULL value in a test other than IsNull

if (isnull ({Non_FormularyDrugReporttest;1.Action})= true ) then
     {Non_FormularyDrugReporttest;1.Qty}  - {Non_FormularyDrugReporttest;1.creditqty}
ELSE if {Non_FormularyDrugReporttest;1.Action}= 'D' then
     {Non_FormularyDrugReporttest;1.Qty}
ELSE if {Non_FormularyDrugReporttest;1.Action} = 'R' then
     {Non_FormularyDrugReporttest;1.Qty}  - {Non_FormularyDrugReporttest;1.creditqty} 

Open in new window


You can also eliminate the comparison to TRUE for the IsNull test

if IsNull ({Non_FormularyDrugReporttest;1.Action}) then
     {Non_FormularyDrugReporttest;1.Qty}  - {Non_FormularyDrugReporttest;1.creditqty}
ELSE if {Non_FormularyDrugReporttest;1.Action}= 'D' then
     {Non_FormularyDrugReporttest;1.Qty}
ELSE if {Non_FormularyDrugReporttest;1.Action} = 'R' then
     {Non_FormularyDrugReporttest;1.Qty}  - {Non_FormularyDrugReporttest;1.creditqty} 

Open in new window


mlmcc
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

726 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