Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: get certain parts from memo field Post Reply Post New Topic
Page  of 2 Next >>
Author Message
campagnolo_1
Newbie
Newbie


Joined: 13 Dec 2011
Online Status: Offline
Posts: 12
Quote campagnolo_1 Replybullet Topic: get certain parts from memo field
    Posted: 13 Dec 2011 at 5:07am
Greetings,
 
I have a bit of an issue creating a formula that will give me certain parts of a memo field. HTe field displays a configuration list for a garment, but I don't want all the quantities and part numbers. All I want is the description - basically everything after the "--" in each line. I have done something simillar in Excel but can't for the life of me figure out how to do it in Crystal.
 
Any ideas?
 
Thanks in advance and below is a sample of the memo field.
 
Chris
 
 
Configuration List
       1.000 EA        (0.00) YCUSTOMCOLOR  --Custom Color Choice
       1.000 EA      (100.00) YGFER-RELSOCMD  --GFER with MD GTX Socks, SM-XL Suits
       1.000 EA        (0.00) YLATEXNECK4  --Large latex neck gasket (ZCUFNEK4BK)
       1.000 EA        (0.00) YGTXWRST3-4W4  --Gore-Tex Inner Wrist Cuff Gasket Prep-one PAIR-MD-LG-WL
       0.000 EA        (0.00) NOALTERLEGS  --No Leg Alteration Chosen
       0.000 EA        (0.00) NOALTERSLEEVE  --No Sleeve Alteration Chosen
       0.000 EA        (0.00) NOALTERRISE  --No Rise Alteration Chosen
       0.000 EA        (0.00) NOALTERTORSO  --No Torso Alteration Chosen
       1.000 EA        (0.00) NOZIPFLAP  --NO Zipper Flap Option Chosen
       0.000 EA        (0.00) NOSUSPENDERS  --No Suspenders Chosen
       0.000 EA        (0.00) NOREFTAPE  --No Reflective Tape Option Chosen
       0.000 EA        (0.00) NOLEFTSLVPKT  --No LEFT Sleeve Pocket Option Chosen
       0.000 EA        (0.00) NORIGHTSLVPKT  --No RIGHT Sleeve Pocket Option Chosen.
       0.000 EA        (0.00) NOELBOWPATCHES  --No Elbow Patches Option Chosen
       0.000 EA        (0.00) NOEMBROIDERY  --No Embroidery Option Chosen
       0.000 EA        (0.00) NODIGITIZECHRGE  --No Charge For Digitizaion Required
       0.000 EA        (0.00) NOHEATTRANSFER  --No Heat Transfer Option Chosen
       0.000           (0.00) ZZYES  --SPECIAL ORDER
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 13 Dec 2011 at 6:11am
gonna have to build an array, then do a mid(right)) combo function
 
When I did it, the list was static, you will have to populate an array with a loop to count lines.
I can help a little more if you wanna private, but others may have easier recommendations
 
 
//shared stringVar array outcom := makearray(" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ");
shared stringVar array outcom := makearray(" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ");
local numbervar x;
local numbervar y;
local numbervar z;
local numbervar w;
local numbervar wx;
shared numbervar cntlines;
shared stringvar array xstr;
shared stringvar newstring;
//shared stringVar array comments := makearray(" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ");
shared stringVar array comments := makearray(" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ");
shared stringvar array incom;
comments[1] := {%engineeringComments};  // A
comments[2] := {%trafficEngineeringComments};  // b
comments[3] := {%waterUtilityComments};  // c
comments[4] := {%zoningComment};  // d
comments[5] := {%fireDepartmentComments};  // e
comments[6] := {%engineeringMappingComments};  // f
comments[7] := {%engineeringMappingComments-CON};  // g
comments[8] := {%realEstateComments};  // h
comments[9] := {%landmarksCommissionComments};  // i
comments[10] := {%urbanDesignCommissionComments};  // j
comments[11] := {%recyclingCoordinatorComments};  // k
comments[12] := {%policeComments};  // l
comments[13] := {%parksComments};  // m
comments[14] := {%transitComments};  // n
comments[15] := {%assessorComments};  // o
comments[16] := {%planningComments};  // p
comments[17] := {%planCommissionHearing};  // q
comments[18] := {%commonCouncilHearing};  // r
comments[19] := {%assessorComments-CON};  // s
comments[20] := {%architecturalReviewComments};//t
comments[21] := {%ligthingReviewComments}; //u
w := ubound(comments);
for wx := 1 to 21 do
(
newstring := "";
incom := split(comments[wx],chr(13));
xstr   := split(comments[wx],chr(13));
y:= ubound(incom);
z := cntlines;
for x := 1 to y do
   if len(incom[x]) > 1 then
    ( xstr[x] := totext(z,0,"","");
      newstring := newstring + replicatestring(" ",5 - len(xstr[x])) + xstr[x] + ". " + replace(incom[x],chr(10),' ') + chr(13);
      cntlines := cntlines + 1;     
      z := z + 1);
outcom[wx] := newstring
);
IP IP Logged
campagnolo_1
Newbie
Newbie


Joined: 13 Dec 2011
Online Status: Offline
Posts: 12
Quote campagnolo_1 Replybullet Posted: 13 Dec 2011 at 10:43am
Found an easier (not necessarily prettier) way:
 
@toText first converts the memo field to text and then you can query it. Downside is that you have to create a detail section for howere many lines you have in the memo field.
 
As I said, not pretty but it works!
 
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 13 Dec 2011 at 10:46am
setup a shared variable to count the number of "--" and in the details section, split from 1-2, 2-3, until the end.
 
That make sense?
IP IP Logged
campagnolo_1
Newbie
Newbie


Joined: 13 Dec 2011
Online Status: Offline
Posts: 12
Quote campagnolo_1 Replybullet Posted: 14 Dec 2011 at 6:17am
I think so...I'll give that a try. Thanks for the idea!
IP IP Logged
campagnolo_1
Newbie
Newbie


Joined: 13 Dec 2011
Online Status: Offline
Posts: 12
Quote campagnolo_1 Replybullet Posted: 14 Dec 2011 at 11:44am
Here is what I came up with, but it only gives me a "1" as result.
 
shared numbervar iIndex := InStr({@ToText}, "--");
shared numbervar cCount:=0;
if iIndex <> 0 then cCount := cCount + 1;
iIndex := InStr({@ToText}, "--");
cCount
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 15 Dec 2011 at 3:32am

there is a loop missing here, you will have to load the array from

1 to iIndex := InStr({@ToText}, "--");
---- however, this code would only show 1 for cCount. unless you didnt add some code.
 
see what iIndex shows as a value
IP IP Logged
campagnolo_1
Newbie
Newbie


Joined: 13 Dec 2011
Online Status: Offline
Posts: 12
Quote campagnolo_1 Replybullet Posted: 15 Dec 2011 at 3:38am
INdex shows 65, which is the first instance of "--". After looking at it first thing this morning it was clear to me that there was no loop and that it would simply stop at the first occurence of "--". I'll have at it some more this morning and see what I can come up with. Thanks for the pointers! ;o)
IP IP Logged
campagnolo_1
Newbie
Newbie


Joined: 13 Dec 2011
Online Status: Offline
Posts: 12
Quote campagnolo_1 Replybullet Posted: 15 Dec 2011 at 4:32am
Ok, change of direction. Instead of trying to count the "--", I changed the formula to count the lines in the memo field: InStr({@ToText}, chr(10))
I tested it and it gave me the correct amount on several different memo fields.
Now how exactly were you thinking to create the appropriate number of detail fields?
IP IP Logged
campagnolo_1
Newbie
Newbie


Joined: 13 Dec 2011
Online Status: Offline
Posts: 12
Quote campagnolo_1 Replybullet Posted: 15 Dec 2011 at 5:55am
Created this thinking it would show me all the lines in the memo field, but all I get is the last line (20) of the memo field.
global NumberVar iIndex := 1;
global NumberVar aArray := 1;
global StringVar tText := "";
global NumberVar aAmount := {@lineCount};
while iIndex <= aAmount Do
(
if InStr((Split(0'>{@ToText},chr(10))[aArray]),"--")>0 then
tText := Mid((Split({@ToText},chr(10))[aArray]),(InStr((Split({@ToText},chr(10))[aArray]),"--"))+2) else
tText := Split({@ToText}, chr(10))[aArray];
aArray := aArray + 1;
iIndex := iIndex + 1;
);
tText


Edited by campagnolo_1 - 15 Dec 2011 at 5:57am
IP IP Logged
Page  of 2 Next >>
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.