Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Parsing a field in the middle ?? Post Reply Post New Topic
Page  of 2 Next >>
Author Message
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Topic: Parsing a field in the middle ??
     Posted: 16 Jul 2013 at 11:32am
Hi

I have a file with data separated by
""@@T_700_ = "text goes here"@@T_301_ = "06/15/2013"@@T_069_ =.....

 I want to pull out just "text goes here"(Without qoutes)
Sorry its always followed by "@@T_301

Thanks in advance
Joe



Edited by jbalbo - 16 Jul 2013 at 11:38am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Jul 2013 at 11:36am
is it always preceded by
""@@T_700_ = "
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 16 Jul 2013 at 11:39am
yes always  @@T_700_ = "

and
Sorry its always followed by "@@T_301


Edited by jbalbo - 16 Jul 2013 at 11:39am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Jul 2013 at 11:50am

stringvar x;
numbervar start;
numbervar end;

 x:=field;
start:= instr(x,'@@T_700_ = ') + 12;
end := instr(x,'"@@T_301');
x:=mid(x,start,end-start);
x

IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 16 Jul 2013 at 12:02pm
Thanks Dan..

I almost have it working :

Im getting an error in the formula sometimes :
"String length is less than 0 or not an interger"

stringvar x;
numbervar start;
numbervar end;

 x:={USER_DEFINED_DATA.ASSESSMENT_DATA};
start:= instr(x,'@@T_700_ = ') + 12;
end := instr(x,'"@@T_301');
x:=mid(x,start,end-start);
x

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Jul 2013 at 12:05pm
do you have instances where you do not have the value in the string ? If so how do you want it handled?
Return a blank? The regular field? 'Missing'?
 
Or are there any records wheresoem version of "@@T_301" comes before "@@T_700_ =" ?
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 16 Jul 2013 at 12:09pm
sorry looking thru more data I find some of the USER_DEFINED_DATA.ASSESSMENT_DATA fields being null
to answer your question if 701area is nulll or the enter field is null I just want a blank space

Thanks Again


yes there are instances on 701 area being blank



Edited by jbalbo - 16 Jul 2013 at 12:12pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Jul 2013 at 3:47am
make sure to set the formula to use default values for nulls
 
try this?
 
 
stringvar x;
numbervar start;
numbervar end;

 x:={USER_DEFINED_DATA.ASSESSMENT_DATA};
start:= instr(x,'@@T_700_ = ')+12;
end := instr(x,'"@@T_301');
x:= if start=12 then "" else if end=0 then "" else mid(x,start,end-start);
x
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 17 Jul 2013 at 4:50am
Looks like still getting the error on mid(x,start,end-start)

Let me see what Im getting for start and end values ...
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 17 Jul 2013 at 5:17am
Hi Dan..

So what I needed was
x:= if start = end then "" else mid(x,start,end-start);
Now I have to figure out why
if start=12 then "" else if end=0 then "" else mid(x,start,end-start);
didn't work??

Thanks so much for the help, now I have a bit of learning to do  :)


IP IP Logged
Page  of 2 Next >>
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