Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Select statement too long - Crystal shuts down Post Reply Post New Topic
Author Message
stephen_
Newbie
Newbie


Joined: 20 Dec 2010
Online Status: Offline
Posts: 3
Quote stephen_ Replybullet Topic: Select statement too long - Crystal shuts down
     Posted: 20 Dec 2010 at 4:32am
Hi all -
I am having a formula issue and was hoping for some assistance. 
 
Basically, I am attempting to write a formula to identify what time zone a given address record is in.  I found an Excel file that decodes time zone from a zip code.  However, when I try to put this data into a formula field, Crystal immediately shuts down.
 
I tried a select statment that looks like this:
 
select {ADDRESS.ADR_ZIP}
case '52501': 'Central'
case '56972': 'Eastern'
etc
etc
default: 'Others'
 
I'm sure my issue has to do with the sheer length of my select statment - it is over 20,000 lines long.
 
Any ideas on what I could do to correct?
 
Thanks in advance for any assistance you can provide.
 
~Stephen
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Dec 2010 at 4:47am
do not use the select statment to do conversion
it is only like the where clause in your SQL
create a formula field to do your case statement
IP IP Logged
stephen_
Newbie
Newbie


Joined: 20 Dec 2010
Online Status: Offline
Posts: 3
Quote stephen_ Replybullet Posted: 20 Dec 2010 at 4:51am
Thanks for the quick response.  Though I'm not clear on what you mean by create a formula field to do the case statement.  Could you post an example of what you mean?
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Dec 2010 at 4:58am
the select statment is only used as a boolean evaluation per row to include (TRUE) or exclude (FALSE) that row from the report.
once you have the data in the report in the FIeld Explorer there is a section called Formula FIelds
Right click on it
Select New
Name it
add your formula here...
If {ADDRESS.ADR_ZIP} = '52501' then 'Central' else
if {ADDRESS.ADR_ZIP} = '56972' then 'Eastern' else ...
else 'OTHER'
 
 


Edited by DBlank - 20 Dec 2010 at 6:14am
IP IP Logged
stephen_
Newbie
Newbie


Joined: 20 Dec 2010
Online Status: Offline
Posts: 3
Quote stephen_ Replybullet Posted: 20 Dec 2010 at 5:00am
Gotcha.  I'll give it a try - thanks again!
IP IP Logged
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