Learn how to a build a cloud-first strategyRegister Now


Crystal Report XI If Statement

Posted on 2007-08-02
Medium Priority
Last Modified: 2008-01-09
I am attempting to add a filter to a crystal report and am I looking for the correct syntex.
I have a product pick ticket that displays the product to be selcted for a specific order. I want to add a filter that will let the user know that the product is expired. I dont want to put the date on the form -just an indicator that the product is expired.  (when the product is expired, instead of the quanity to pick display a statement that lets the user know this product is expired)
I have tried varients of the syntax below, but it keeps telling me that it is looking for a statement.
end if

Crystal Reports XI Dev
Question by:GregJaroch
  • 2
  • 2
LVL 28

Expert Comment

ID: 19616481
You can't change the value of a database field, which is what your statement looks like it is trying to do.
You need to have the formula return a result like this:

if {PART_BATCHES.BATCH_DATE} <= currentdate
then "exp"

Make sure that the formula syntax is set to "Crystal Syntax".  It will be in a drop down in the formula editor.

Author Comment

ID: 19616592
bdreed35, Thanks! I tried your syntax, and your suggestion give the error formula result must be boolean... ???
LVL 28

Accepted Solution

bdreed35 earned 2000 total points
ID: 19616625
Where are you putting this formula?  You need to go the Field Explorer, right click on "Formula Fields", and choose New.  Give it a name and then paste the logic I gave you there.
If you still get the error after that, you will need to tell me what data types Batch Date and Qty In Bin are.

Author Comment

ID: 19616722
Excellent! I was trying to put the formula in as a common suppress varible. (Format Field).
When I put the code within the field explorer it worked - Thanks!

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Simple Linear Regression
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

810 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