| Author |
Message |
jbalbo
Senior Member
Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
|

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 Logged |
|
|
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|

Posted: 16 Jul 2013 at 11:36am |
is it always preceded by
""@@T_700_ = "
|
IP Logged |
|
jbalbo
Senior Member
Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
|

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 Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|

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 Logged |
|
jbalbo
Senior Member
Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
|

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 Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|

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 Logged |
|
jbalbo
Senior Member
Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
|

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 Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|

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 Logged |
|
jbalbo
Senior Member
Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
|

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 Logged |
|
jbalbo
Senior Member
Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
|

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 Logged |
|
|
|