Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trimming a Number

Status
Not open for further replies.

CNeeds

Programmer
Mar 24, 2004
111
US
I have this field that I converted to a number, (ie. 20070508012385) I would like only the first 8 numbers (20070508) to appear...I try Left, Right in my formula which I was unsuccessful due to it being a number. When I try as a String, it put commas with is no good. Thanks for any ideas!!!
 
I think we need more info. What is the original format when it is a string? This looks like a date/time value, why is it a string originally? Have you considered converting the string to a date instead of a number formatting the date to be "yyyymmdd"?

 
I know, it's weird...the orginal format has 16 digits that is combined with date & time...I just need suggestions to only get the first 8 digits seperated.
 
left(totext({YourField},0,""),8)

or to keep it a number the entire time:

int({YourField}/10000)



Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"If you have a big enough dictionary, just about everything is a word"
--Dave Barry
 
Try:

val(left(totext({table.field,0,""),8))

or if you want it to be text, just use:

left(totext({table.field,0,""),8)

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top