Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Basic number formatting issue Post Reply Post New Topic
Author Message
liddlem
Newbie
Newbie
Avatar

Joined: 06 Oct 2010
Location: Australia
Online Status: Offline
Posts: 10
Quote liddlem Replybullet Topic: Basic number formatting issue
    Posted: 03 Apr 2011 at 8:52pm
Hello readers.
I am tired of trying to make various number present in the format that I need them.
 
For example, dates (which are stored as yyyymmdd) always display as yy,yym,mdd.00 - is there a way that I can ALWAYS get the number to display as whole number. ie without having to specifically change the display property every time that I use the field in my report.
 
Another are where I am having difficulty is each user has a numerical ID.
They have a staff photo associated to them.
In one of my reports, I want to display their photo - which means creating a filename on the fly such as 123.jpg  or 2398.jpg - but crystal insists on using 123.00  or 2,398.00.
 
By using
stringvar PicName:= totext(truncate(StaffID)) &".jpg"
I am able to get rid of the trailing ".00", but this still produces "2,398.jpg" where the staff id is > 1000
 
There must be an easier way to get rid of the "," than breaking up the string every 3 characters.
If you know how - please share it with us.
 
Thanks
Thanks for your input
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 04 Apr 2011 at 3:07am
totext(StaffID, 0, "") does both. as for the date, I believe that it uses the computer formatting of the date as a default, so you probably need to specify that.
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 04 Apr 2011 at 6:03am
For example, dates (which are stored as yyyymmdd) always display as yy,yym,mdd.00 - is there a way that I can ALWAYS get the number to display as whole number. ie without having to specifically change the display property every time that I use the field in my report.


These are defined in the crystal report settings.
Go to File --> Options --> Fields tab.

Select the default settings for each type of field (all 7 are there for you). If you want numbers to be whole numbers, you would click on numbers and go through the same procedure. Except this time it will apply to all future reports.

Yes, this does not change existing reports, but that shouldn't matter because you've already gone through the trouble of formatting them yourself


Edited by Keikoku - 04 Apr 2011 at 6:07am
IP IP Logged
liddlem
Newbie
Newbie
Avatar

Joined: 06 Oct 2010
Location: Australia
Online Status: Offline
Posts: 10
Quote liddlem Replybullet Posted: 04 Apr 2011 at 4:24pm
Thanks to both of you.  
 
Errrr . . .still have a problem though.
 
All pictures up to 999 are being displayed.
Anything over 1000 is showing the default "NoPicAvailable.Jpg"
 
I have tried debugging by displaying the path string and it is displaying correctly as '\\Server\folder\path\1006.jpg'
 
any other ideas?
Thanks
 
 


Edited by liddlem - 04 Apr 2011 at 4:33pm
Thanks for your input
IP IP Logged
liddlem
Newbie
Newbie
Avatar

Joined: 06 Oct 2010
Location: Australia
Online Status: Offline
Posts: 10
Quote liddlem Replybullet Posted: 04 Apr 2011 at 5:58pm
Oooops.
Just found a formula field that I had forgotten about.
I was trimming off the last 3 characters (".00") - but this is no longer neccessary.
 
Thanks again for your help.
Thanks for your input
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.