Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula doesn't work Post Reply Post New Topic
Author Message
btamulis
Newbie
Newbie
Avatar

Joined: 02 Aug 2008
Online Status: Offline
Posts: 9
Quote btamulis Replybullet Topic: Formula doesn't work
    Posted: 07 Feb 2012 at 6:39am
Crystal X -
 
Here's my formula:
 
if {gpv_SalesOrders.batchid} startswith 'N' then 1 else if
{gpv_SalesOrders.batchid} startswith 'O' then 2 else if
{gpv_SalesOrders.batchid} startswith 'P' then 3 else if
{gpv_SalesOrders.batchid} startswith 'W' then 4
 
Here's my Dataset........
 
N20120106-1
N20120203-2
W20120126-7
P20120103-6
O20120201-1
W20120104-3
etc.....
 
Standard report - formula doesn't error but doesn't return anything.....
 
Note - One batchid does start with 01072012SW (formula obviously doesn't cover this dataset........do I need to alter formula to catch 'all the non-conforming datasets? If so, how?
 
Anybody have a suggestion?
Thanks to all who contribute to this forum!!!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Feb 2012 at 7:04am

it looks fine.

it would return a 0 for your outlyer.
So you place the batchid and the formula field side by side on the detail section and get no results (all NULLs) for the formula or all zeros?
IP IP Logged
btamulis
Newbie
Newbie
Avatar

Joined: 02 Aug 2008
Online Status: Offline
Posts: 9
Quote btamulis Replybullet Posted: 07 Feb 2012 at 7:20am
I found the problem (with your help).........
 
The data element referenced in my formula was not physcially located on the report - once I dragged it onto the report - it displayed correctly.
 
I'm surprised the field ({gpv_SalesOrders.batchid}) had to be a report field.....
 
Your thoughts? I haven't done crystal report in awhile - but I could swear I've done formulas using non report fields before........
 
Thanks again - if you have any thoughts - I'm always willing to learn
Thanks to all who contribute to this forum!!!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Feb 2012 at 7:48am
you should be able to reference any field in a formula (assuming it is in your source for the report) without using that field in the actual report canvas.
One thought,
If you have multiple tables that are joined in the report and you did not set the joins to be enforced then the data set can alter. The joins do not become "active" (if not enforced) until a field is used from the table. THis is often described by people as there data disappearing when they drag a field onto their report.
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.