Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can CR detect a crlf in a memo field?

Status
Not open for further replies.

FireGeek21

Technical User
Dec 12, 2007
218
US
Can CR detect a crlf in a memo field? If so, how can this be done? Ideally, looking to detect the number of crlf's in a memo field and separate all that data out into separate columns.

Example Data:

7/70
SFT7
80
Male
Caucasion

I would like the above memo field parsed out as follows (separate columns):

Data1 Data2 Data3 Data4 Data5
7/70 SFT7 80 Male Caucasion

Thoughts?



FireGeek
(currently using Crystal Reports XI with Lawson 8.03)
 
yes it can.

i do not have crystal open in front of me, and as such, do not trust my formulas from memory, but think that you will need a formula for each column.

You could use Split to break the memo into separate values on the carraige return (ASCII value 13)

It would look something like this:
//{@SplitMemo1}
stringvar tt := totext({table.memo});
Split(tt,chr(13))[ubound(Split(tt,chr(13)))]
 
+1 to ChelseaTech


i should start reloading the page before posting when i am away from the computer for a few mintues. :)
 
Thank you both fisheromacse and chelseatech for your responses. On both your formulas, I am getting the following error, "A subscript must be between 1 and the size of the array". Seems it doesn't like the information in the [] on both formulas.

FireGeek
(currently using Crystal Reports XI with Lawson 8.03)
 
I got it to work... It turns out I was using the wrong memo field. The field I was using did not always have something entered into it. Which is good that I found this problem. I needed to account for a situation in which the memo field had nothing in it. Here is the end result.

stringvar tt := totext({TABLE.MEMO_FIELD});
numbervar a := count(split(tt, chr(13)));
if a >= 1 THEN Split(tt, Chr(13))[a] ELSE ""

THANK YOU BOTH for all your help!!!

FireGeek
(currently using Crystal Reports XI with Lawson 8.03)
 
Try:

stringvar array x;
if not isnull({table.memo}) then
x := split({table.memo},chr(10));
if ubound(x) >= 2 then
x[2];

Replace the 2 in each line with the number of the array element. You might have to see whether the memo field needs to be split by chr(10) or chr(13) or by chr(10)+chr(13)--by replacing chr(10) in the split function. Not sure about the order of chr(10) and chr(13), but that is easily tested.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top