Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Extracting part of a string Post Reply Post New Topic
Author Message
TorLang
Groupie
Groupie


Joined: 13 Jun 2012
Location: United States
Online Status: Offline
Posts: 50
Quote TorLang Replybullet Topic: Extracting part of a string
    Posted: 02 Jun 2016 at 3:30am
I have a text field that looks like this:

Statement Processed, balance of 1156.00 for invoice 3000010004-0001Statement Path - SP After Ins, Step - 3 Self Pay After Ins 1

The string is identical in all records, except the amount 1156.00 changes.

So I need to extract the amount in each record. I suspect I have to use variable in a custom formula, but stuck as to how to get that done. Anyone done something similar before?
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 02 Jun 2016 at 4:00am
So if the string formatted the same for all records.  If so you might be able to do something like this.

left({somestring},instr({somestring},' for')
IP IP Logged
TorLang
Groupie
Groupie


Joined: 13 Jun 2012
Location: United States
Online Status: Offline
Posts: 50
Quote TorLang Replybullet Posted: 02 Jun 2016 at 5:37am
Half way there. Using your formula, I get everything behind the amount stripped:

Statement Processed, balance of 1156.00

How do I strip what is to the left of the amount? The only thing I need left is:

1156.00

I know, I'm just a pain.....:-)
IP IP Logged
TorLang
Groupie
Groupie


Joined: 13 Jun 2012
Location: United States
Online Status: Offline
Posts: 50
Quote TorLang Replybullet Posted: 02 Jun 2016 at 6:25am
Got it....thanks.

ExtractString({fieldname}, "of ", " for")
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 02 Jun 2016 at 7:45am
Forgot about the extractstring.  Do not use it very often.
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.015 seconds.