Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Number of digits Post Reply Post New Topic
Author Message
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Topic: Number of digits
     Posted: 02 Dec 2010 at 8:23am
I want to display the number of digits in a number (so 102 would have 3 digits, 2004 would have 4 digits, and so on)

I thought of converting it to string first and then putting that through the length function, but it returns 8 instead.

That's cause it adds a bunch of commas and a decimal and 00's.

Is there a way to make it so I convert 2000 to "2000" without changing it? Or maybe just another way to calculate the number of digits..

Edited by Keikoku - 02 Dec 2010 at 8:25am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Dec 2010 at 8:33am
One way:
len(totext({table.numberfield},0,""))
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 02 Dec 2010 at 9:44am
Is there a difference between how the totext function and the CStr function works? They both seem to be converting to a string.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Dec 2010 at 9:47am
They are the same
IP IP Logged
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