Print Page | Close Window

Finding a specific number in a number field

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=19078
Printed Date: 28 Mar 2024 at 12:14pm


Topic: Finding a specific number in a number field
Posted By: Rodemusprime
Subject: Finding a specific number in a number field
Date Posted: 11 Feb 2013 at 5:19am
I have a field NUMBERS. that contains phone numbers.  I need a formula that will search for the 4th number in that field, and if that number is either a "0" or a "1", I need it omitted.  Otherwise I want the number shown.

EX:

2120111234
2121111234
2125551234

I do not want my report to display the first 2 numbers. 



Replies:
Posted By: kevlray
Date Posted: 21 Feb 2013 at 12:55pm
I think this is what you need in the suppress formula of the fields.

If mid(totext({NUMBERS}),4,1) = "0" or mid(totext({NUMBERS}),4,1) = "1" then true else false.

I have not tested this formula.  Basically we are converting the number to a text (I am assuming we are working with a numeric field) and checking the fourth character to see if it is a zero or a one.  If so, then return a true condition else a false condition.  A true condition in the suppress formula for a field will suppress the field.



Print Page | Close Window