Print Page | Close Window

truncate a number

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=12156
Printed Date: 02 May 2024 at 10:02pm


Topic: truncate a number
Posted By: fabiola
Subject: truncate a number
Date Posted: 26 Jan 2011 at 2:19am

Hi All

i'm a newbie to Crystal Reports. Hope someone can help me out.
 
I have a 19 digit number on a report and would like to see only the last 6 digits? How is this done?
If you show step by step
TIA
Fabiola 



Replies:
Posted By: DBlank
Date Posted: 26 Jan 2011 at 3:40am
right(totext(numberfield,0,""),6)


Posted By: Emir_W
Date Posted: 26 Jan 2011 at 4:09am
hi DBlank,

it is showing in exponential format.
e.g.: 1234567890123456789 --> 1e+019

it should shown as 456789.

we need to work around for it.



-------------
Emir W


Posted By: DBlank
Date Posted: 26 Jan 2011 at 4:21am
not sure i understand. The data as it is brought into crystal is appearing as the expontial version or it is appearing a numeric field with a length of 19?


Posted By: fabiola
Date Posted: 26 Jan 2011 at 4:57am

 it is appearing a numeric field with a length of 19

Here is an example
9874563214569874563
I would like to see
874563


Posted By: DBlank
Date Posted: 26 Jan 2011 at 5:16am
did you try the formula I gave you on my first post?
right(totext({table.numberfield},0,""),6)


Posted By: fabiola
Date Posted: 26 Jan 2011 at 5:22am
I did ...and get a message back saying to many arguments have been given to this function


Posted By: DBlank
Date Posted: 26 Jan 2011 at 5:25am
what do you get with
totext({table.numberfield},0,"")


Posted By: fabiola
Date Posted: 26 Jan 2011 at 5:35am
this is what i entered

totext({vw_FactCardTransHist.CardNo},0,"")
 
i got back too many arguments have been given to this function


Posted By: DBlank
Date Posted: 26 Jan 2011 at 5:47am

I think this isaleady a string field that is displaying numbers.

try
right({vw_FactCardTransHist.CardNo},6)


Posted By: fabiola
Date Posted: 26 Jan 2011 at 5:56am
Kudos! It Worked!
Thanks a Bunch!



Print Page | Close Window