• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 509
  • Last Modified:

Crystal Report XI If Statement

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
GregJaroch
Asked:
GregJaroch
  • 2
  • 2
1 Solution
 
bdreed35Commented:
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
 
GregJarochAuthor Commented:
bdreed35, Thanks! I tried your syntax, and your suggestion give the error formula result must be boolean... ???
0
 
bdreed35Commented:
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
 
GregJarochAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now