Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Parse Data Post Reply Post New Topic
Author Message
adriennelisa
Newbie
Newbie


Joined: 16 Mar 2010
Location: United States
Online Status: Offline
Posts: 1
Quote adriennelisa Replybullet Topic: Parse Data
    Posted: 16 Mar 2010 at 2:18am
I have a CR report that is pulling from a SQL db. The field name is "Parameter" and dumps into the report like this:

Secondary Address City=605 VIRGINIA BEACH BLVD.NORFOLKSecondary Address Line 1=RIDE AWAY Att:Richard Turner6059 VIRGINIA BEACH BLVDSecondary Address Location Name=rideRIDE

I would like to make it split out to look like the below table.

Field Name

 Previous Value

New Value

Secondary Address City

NORFOLK

605 VIRGINIA BEACH BLVD.

Secondary Address Line 1

6059 VIRGINIA BEACH BLVD

RIDE AWAY Att:Richard Turner

Secondary Address Location

RIDE

ride

Nam

Adrienne Scott
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 19 Mar 2010 at 3:38am
if you know the verbiage and the non-printing characters, you can use INSTR() and MID() to parse the string into different variables.
 
local numbervar iNext;
local numbervar iThis;
local stringvar temp;
shared stringvar preCity:="";
shared stringvar newCity:="";
iThis := instr({table.parameter}, "Secondary Address City");
if iThis > 0 then(
  iNext := instr(ithis + 1, {table.parameter}, "Secondary");
  if iNext = 0 then
    temp := mid({table.parameter}, iThis + len("Secondary Address City")  //too lazy to count
  else
    temp := mid({table.parameter}, iNext - (iThis + len("Secondary Address City")) - 1);
  iThis := instr(temp, chrw(9)); //assuming tab character 
  newCity:=Left(temp, iThis - 1);  
  priorCity:=mid(temp, iThis + 1, Len(temp) - iThis - 2);
);
 
""  //to hide formula output
 
 
now you should be able to access the shared variables from another formula and place them in the report as desired.
 
This isn't tested, but it should a) give you an idea of how you could proceed, b) get you really close.
 
HTH
 
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.