Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Pulling numbers from text Post Reply Post New Topic
Page  of 2 Next >>
Author Message
dsenger
Newbie
Newbie


Joined: 17 Jul 2012
Online Status: Offline
Posts: 8
Quote dsenger Replybullet Topic: Pulling numbers from text
     Posted: 17 Jul 2012 at 9:02am
I am trying to pull a number from text and have been unsuccessful.  Any ideas?

Edited by dsenger - 17 Jul 2012 at 9:03am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Jul 2012 at 9:06am
please explain your data in more detail and what you need the result from it to be.
IP IP Logged
dsenger
Newbie
Newbie


Joined: 17 Jul 2012
Online Status: Offline
Posts: 8
Quote dsenger Replybullet Posted: 17 Jul 2012 at 9:16am
It somewhat field like the following:
 
49 (High Risk Needs; Approximately 76.0% Chance of Recidivism)
 
I need to pull the 49 out, etc.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Jul 2012 at 9:27am
if it is always the first 2 characters
tonumber(left(table.field,2))
 
if you have other variations on it it needs to be adjusted for that.


Edited by DBlank - 17 Jul 2012 at 9:28am
IP IP Logged
dsenger
Newbie
Newbie


Joined: 17 Jul 2012
Online Status: Offline
Posts: 8
Quote dsenger Replybullet Posted: 17 Jul 2012 at 9:53am
They have all been changed to be the first characters already.  I put the formula in and changed the field and it is giving me an error that it needs to be a string.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Jul 2012 at 10:11am
I did not understand your last post. can you please clarify.

Edited by DBlank - 17 Jul 2012 at 10:11am
IP IP Logged
dsenger
Newbie
Newbie


Joined: 17 Jul 2012
Online Status: Offline
Posts: 8
Quote dsenger Replybullet Posted: 17 Jul 2012 at 10:17am
This is the formula I am using: 
 
tonumber(left({OFFENDER_REPORT_TEXTS.CATEGORY_TEXT},2)) and
 
this is the field I am pulling from:
 
49 (High Risk Needs; Approximately 76.0% Chance of Recidivism)
 
When I go to save the formula, it is highlighting the formula and stating that a Bolean is required here.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Jul 2012 at 10:22am
are your putting the formula in the select expert?
IP IP Logged
dsenger
Newbie
Newbie


Joined: 17 Jul 2012
Online Status: Offline
Posts: 8
Quote dsenger Replybullet Posted: 17 Jul 2012 at 10:41am
Yes
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Jul 2012 at 11:07am
the select expert is only used to determine if a row of data should be included (true) or exlcluded (false) in the report.
You want to go to the Field Explorer
right click on Formula Fields
select New
name your formula (e.g.numeric_category)
put your formula in this window
tonumber(left({OFFENDER_REPORT_TEXTS.CATEGORY_TEXT},2))
save it
and drag and dop the formula field onto your report canvas
IP IP Logged
Page  of 2 Next >>
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