Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using if statement in supress formula

Status
Not open for further replies.

Bluejay07

Programmer
Mar 9, 2007
780
CA
Hello,

I have a report with a supression formula:
{OEORDD.QTYORDERED}=0;

I would also like to add some statements and executed only if the above is true.

I'm assuming I would need something similar to:
Code:
{OEORDD.QTYORDERED}=0;

If {OEORDD.QTYORDERED}=0 Then
WhilePrintingRecords;
NumberVar recNum; 
recNum:=recNum-1;

When I check the formula I get an error indicating that the result must be a boolean.

Could someone please correct my code.
Thank you.

If at first you don't succeed, then sky diving wasn't meant for you!
 
Boolean means True or False. Basically the result of your formula needs to be a True or a False when using it to suppress. It appears you need a second formula to execute the code you have in the box.

I hope this helps.
 
YOu can not evalute a var in the section expert.

Create a formula and place this in body of report of section you are suppressing.

@Recnum
WhilePrintingRecords;
NumberVar recNum;

If {OEORDD.QTYORDERED}=0 Then
recNum:=recNum-1;

Ian
 
Thank you to both of your for your responses, although kray4660 your response wasn't all that helpful. I am a programmer and I am aware of what a boolean value is. I was looking for specific advice on how to fix my code and address the error.

Ian, thank you for being more specific. Your example seems to work.

As a side note, if the order was reversed
Code:
WhilePrintingRecords;
NumberVar recNum; 
recNum:=recNum-1;

{OEORDD.QTYORDERED}=0;
the formula did not provide any errors although recNum was decreased everytime which was not the expected result.

Thank you both again for taking the time to respond.

If at first you don't succeed, then sky diving wasn't meant for you!
 
Sorry about the assumption. I guess I have been doing this too long.
 
Hey, no worries. As mentioned, I am still grateful that you took the time to respond. Sometimes even some small comments might trigger a thought on how to approach the situation different.


If at first you don't succeed, then sky diving wasn't meant for you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top