Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Help on Formula Post Reply Post New Topic
Author Message
SFDC
Newbie
Newbie


Joined: 12 Nov 2008
Location: India
Online Status: Offline
Posts: 7
Quote SFDC Replybullet Topic: Help on Formula
    Posted: 13 Jan 2009 at 4:04am
Hi,
 
I have a field called SNO will have(1000,1001,1002 etc).
 
TNO field values like->1000..1005,1006..1009,1010..1016
 
here In select Expert I need to write a formula aganist SNO to get the second splitted values of TNO.(after..)
 
SNO=split(TNO) should return 1005,1009,1016 records.(3 rec should delimitted by comma)
help me out.
 
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 13 Jan 2009 at 6:19am
so the tno field is a comma delimited string, or each field would look like 1000..1005?
 
If the later, there isn't a function.  Crystal does not select data like that, you can only look at 1 line at a time.  On the other hand, if it is this case, you could build a formula that would keep appending to a string that you could display in the group footer.
 
If just one record of TNO is 1000..1005,1006..1009,1010..1016 you should be able to write a formula to split it.  I know that Crystal can loop, but I have never done it...never needed to.
 
the formula to split up the line is pretty simple
local stringvar orig := {tno}
local numbervar comma := instr(orig, ",")
local stringvar commaSep;
local stringvar ret;
 
while orig <>"" do
(
  if comma > 0 then (
    commaSep := left(orig, comma-1);
    orig := mid(orig, comma + 1);
  )
  else(
    commaSep = orig;
    orig := ""
  );
 
  ret := ret + ", " + mid(commaSep, instr("..")+2);
);
 
ret
 
This should do it.
 
Hope this helps
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.031 seconds.