Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: How to extract text from memo field Post Reply Post New Topic
Author Message
FECSII
Newbie
Newbie
Avatar

Joined: 21 Sep 2009
Location: United States
Online Status: Offline
Posts: 22
Quote FECSII Replybullet Topic: How to extract text from memo field
     Posted: 31 Aug 2010 at 9:08am
Hello
 
I would like to extract specific text from a memo field - currently using CR 2008.
 
Text in the memo fields can look like something like these:
 
Record 1:
 
TltPrice from 2 to 1
Cost from 20 to 30
DaysSupply from 1 to 5
Qty from 0 to 1
 
Record 2:
 
Cost from 50 to 22
DaysSupply from 7 to 2
Qty from 2 to 1
TltPrice from 5 to 10
 
so on and so forth... (DaysSupply does not have the same line number every time)
 
What I have done is created a Formula Field called MemoField and in the Formula Editor entered the original memo field -since Crystal does not "support" memo fields. I filtered the @MemoField to show anything like *DaysSupply* in the Record Expert.
 
I ran the report and did get only the records that do have "DaysSupply" in that memo field, BUT I am also viewing all the other text in that memo field. 
 
I would like to view ONLY the DaysSupply line. Is that possible?
 
I have also been reading about using the INSTR & LEFT functions, but am confused how to apply it. I tried this as well:
 
if instr({PatientsLog.Msg},"DaysSupply")>0 then
true
else
false
 
FYI - {PatientsLog.Msg} is the original memo field.
 
 
Can this be done? Any help would be greatly appreciated.
 
Thanks in advance!
 
 
 
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 Aug 2010 at 10:28am
is the DaysSupply line always followed by the Qty line?
IP IP Logged
FECSII
Newbie
Newbie
Avatar

Joined: 21 Sep 2009
Location: United States
Online Status: Offline
Posts: 22
Quote FECSII Replybullet Posted: 01 Sep 2010 at 3:17am

no, unfortunately there is no definite line the "DaysSupply" text will be on. It could be in any random order....

Thanks for the inquiry...
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 01 Sep 2010 at 3:45am
try:
mid(
{PatientsLog.Msg},
instr(
{PatientsLog.Msg},"DaysSupply from"),
instr(instr(
{PatientsLog.Msg},"DaysSupply from"),{PatientsLog.Msg},chr(13))-instr({PatientsLog.Msg},"DaysSupply from")
)
IP IP Logged
FECSII
Newbie
Newbie
Avatar

Joined: 21 Sep 2009
Location: United States
Online Status: Offline
Posts: 22
Quote FECSII Replybullet Posted: 01 Sep 2010 at 4:09am

Hello

I entered your above formula and its prompting for a boolean.
 
"The result of selection formula must be a boolean"....
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 01 Sep 2010 at 4:13am
This is not to be used n the select expert.
Continue to use your "like *DaysSupply* " selection criteria to limit the rows to what you want.
My formula is to be used as a Formula Field.
In the field explorer right click on the FOrmula Fields and select New.
Name it whatever
enter the formula
place the formula field on the report canvas to see the extracted line
IP IP Logged
FECSII
Newbie
Newbie
Avatar

Joined: 21 Sep 2009
Location: United States
Online Status: Offline
Posts: 22
Quote FECSII Replybullet Posted: 01 Sep 2010 at 4:20am
I was actually entering that formula into the Group Selection... no wonder it did not work.
 
The Formula Field worked!! THANK YOU so much for your quick response!!
 
 
Big%20smile
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