[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

IF THEN LOOP

Posted on 2014-04-02
2
Medium Priority
?
178 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 2000 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

649 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