Talk with the Author
 Crystal Reports Forum : General Information : Talk with the Author
Message Icon Topic: Field splitting Post Reply Post New Topic
Author Message
mrc161
Newbie
Newbie


Joined: 27 Dec 2007
Location: United States
Online Status: Offline
Posts: 19
Quote mrc161 Replybullet Topic: Field splitting
    Posted: 31 Jul 2008 at 12:04pm
Hello.  I'm having an issue regarding a comma delimited field, and would appreciate any help that you can provide.
 
I have a single field (call it Field X) that can have up to 26 different 4-character ids in it, each separated by a comma.  As an example:
 
Record 1 could have Field X=INCM,CASH,LIQU,DECB
Record 2 could have Field X=CASH,INCM,BALA,TERM
etc.etc.
 
What I need to do is take Field X, and incorporate their true, literal descriptions.  I.E., INCM means "Income Insufficient".  CASH means "Cashflow Insufficient", etc, etc.
 
So for Record 1 as an example, I need to take Field X=INCM,CASH,LIQU,DECB, and convert the 4 ids into:
"Income Insufficient,Cashflow Insufficient,Liquidation,Derogatory Business Credit".
 
However, because I can have anywhere from zero to 26 different possibilities, and those 26 possibilities can be in any kind of order, I'm trying to find the easiest way to "switch" the 4-character id for the true description.
 
I've played around with Switch and/or Choose and I can't get anything to work.  If anyone has any suggestions, I'd appreciate it!  Thanks, Mike
IP IP Logged
vallance
Newbie
Newbie
Avatar

Joined: 28 Jul 2008
Location: United States
Online Status: Offline
Posts: 12
Quote vallance Replybullet Posted: 01 Aug 2008 at 9:39am
I would try using the Mid function. If that doesnt work, try split.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 02 Aug 2008 at 9:06pm

How many total codes do you have? You could do a formula something like this:

stringvar descrips := {table.code field};
descrips := replace(descrips, "INCM", "Income Insufficient");
descrips := replace(descrips, "CASH", "Cash Insufficient");
...<go through all of your possible codes>...
descrips
 
The final line is important.  DO NOT put a semi-colon (;) at the end of it.  Put this formula on your report instead of the field.  If you're in Crystal XI, this should be no problem.  If you're in (I believe) any earlier version, there is a 250 character limit  for strings.
 
-Dell
IP IP Logged
mrc161
Newbie
Newbie


Joined: 27 Dec 2007
Location: United States
Online Status: Offline
Posts: 19
Quote mrc161 Replybullet Posted: 12 Aug 2008 at 1:18pm
Thank you!  That worked perfectly!
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.020 seconds.