Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: If statement with no results Post Reply Post New Topic
Author Message
absiin
Newbie
Newbie


Joined: 07 Jan 2015
Location: United Kingdom
Online Status: Offline
Posts: 7
Quote absiin Replybullet Topic: If statement with no results
    Posted: 22 Jan 2015 at 5:16am
Hi all :)

I've been working with crystal reports for about a month now so i'm sorry for maybe some rather 'dumb' questions!

I've got two fields coming from the db > qty ordered and qty delivered.

If my customer order their items through us but the supplier delivers their goods the invoice will show as qty delivered = 0.

Now I want to put a filter in that if the qty delivered is 0 set it to be = to the qty ordered.

Now things get a bit confusing.. two different types or order use the same template, the orders that go through supplier and orders that I handle both having a particular type...

So this is what I'm trying to do....

IF ORDER.TYPE = 'SOI' THEN ORDERQ.DLVQTY = ORDERQ.QTY

I'm putting this on the formula of the field but the entire report comes back blank or theres no change?!

Any ideas? Does it make sense?!

I'm confused...
Absiin ~
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Jan 2015 at 7:40am
you cannot alter the data that exists.Crystal reads data it does not edit data.
You can create a formula field to add to your data set and use existing data to derive a value that is unique per row.
 
Also do not put these types of fomrulas into the select expert. The select expert is how you select or filter out specific rows or groups of data from your data set. BY putting your current formula into the select expert you are basically evaluating each row for a T/F answer to your formula which is always returning a false, thereby excluding all rows of dta from your report, hence no results.
 
In the field explorer create a new formula field called "updatedQty" (or whatever you want) 
IF ORDER.TYPE = 'SOI' THEN  ORDERQ.QTY  ELSE ORDERQ.DLVQTY
 
Place the formual field onto th detail section to see if you are getting the value you expect.
Remember though you did not alter DLVQTY, you just added a new "field" that is executing the formula to get a result.
IP IP Logged
absiin
Newbie
Newbie


Joined: 07 Jan 2015
Location: United Kingdom
Online Status: Offline
Posts: 7
Quote absiin Replybullet Posted: 23 Jan 2015 at 12:24am
Hi!

Yes that worked perfectly! :D

Thank you sooo much!!
Absiin ~
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.