Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Crystal Report XI If Statement

Posted on 2007-08-02
4
Medium Priority
?
507 Views
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.
if {PART_BATCHES.BATCH_DATE}<= today
then {BIN_LOCATION_DETAILS.QTY_IN_BIN}="exp"
else {BIN_LOCATION_DETAILS.QTY_IN_BIN} = {BIN_LOCATION_DETAILS.QTY_IN_BIN}
end if



Crystal Reports XI Dev
0
Comment
Question by:GregJaroch
  • 2
  • 2
4 Comments
 
LVL 28

Expert Comment

by:bdreed35
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"
else totext({BIN_LOCATION_DETAILS.QTY_IN_BIN},0)

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

Author Comment

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

Accepted Solution

by:
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.
0
 

Author Comment

by:GregJaroch
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!
0

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