Solved

How to truncate a string

Posted on 2014-12-17
4
85 Views
Last Modified: 2015-01-06
This may sound simple to you, but not to me.  I need to create a formula in Oracle Crystal that removes the first 4 characters in a field and leaves me with the rest of the field to show.  Then I want to be able to use this new formula/field to evaluate the contents and provide a select statement from it.

Example:  "ICD-401.01"  This is the contents of the field.  I need a new field with just 401.01 in it and then reference that field in a select statement that says {field} = [401.01, 401.02, 401.11, 456.24]
0
Comment
Question by:Becky Edwards
4 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40506130
I'm not a Crystal person but can help with the SQL.

Turning ICD-401.01 into 401.01 is easy:
select substr('ICD-401.01',5) from dual;

I have no idea what you mean by:
reference that field in a select statement that says {field} = [401.01, 401.02, 401.11, 456.24]

Maybe:
select 'Found it' from dual where substr('ICD-401.01',5) in (401.01, 401.02, 401.11, 456.24);
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 40506370
Try this

Mid({FIeld},4) IN ['401.01',  '401.02', '401.11', '456.24'] 

Open in new window


If you need to use then numeric strings as numbers then you need to convert the string

Val(Mid({FIeld},4)) IN  [401.01, 401.02, 401.11, 456.24] 

Open in new window


mlmcc
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 40512281
Hi, do you need it in oracle or some other ?
0
 

Author Closing Comment

by:Becky Edwards
ID: 40534160
This worked perfectly.  Thank you.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now