Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: parsing data ??? Post Reply Post New Topic
Author Message
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Topic: parsing data ???
     Posted: 11 Jun 2014 at 10:33am
Hi

I have a field (assessment) where the data looks simialr to this

@@T_098_ = "abc"@@T_099_ = "def"@@T_100_ = "ghi"@@T_101_ ="jkl "...etc

I need to figure out a formula to get whats in between the qoutes

for example I need just abc which is between @@T_098_ = " and  "@@T_099_ = "

Hope it makes sense and thanks

IP IP Logged
Gurbs
Senior Member
Senior Member
Avatar

Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Quote Gurbs Replybullet Posted: 13 Jun 2014 at 1:00am
you can try the function split?
So this:
split({table.assessment})[2]
will give you abc
this:
split({table.assessment})[4]
will you give def

etc etc

Hopes this helps
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 17 Jun 2014 at 10:14am
if it is truly embedded quotation marks, you could try something like:
local stringvar result :="";
local numbervar index;
local booleanvar flag := false;
for index:=1 to len({table.field}) do(
if instr({table.field}, index,1) = chrw(34) then
    flag = not flag   //flip the flag (true, want, false ignore
else
    if flag = true then
      result := result + instr({table.field}, index, 1)
);
result


it should work. there is probably a more elegant method using instr and mid, but this seems the most straight forward. I like Split() and it should work. I would probably split the field then concatenate all the even values (if that is what you are after).

Either way, hope one of these ways works for you.
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