Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Zeros to fill Post Reply Post New Topic
Page  of 2 Next >>
Author Message
jbrandes99
Newbie
Newbie


Joined: 02 May 2011
Location: United States
Online Status: Offline
Posts: 17
Quote jbrandes99 Replybullet Topic: Zeros to fill
    Posted: 28 Jun 2011 at 9:52am
Me again...in need of assistance please.  I need to figure out a way to create a formula that displays {account_no}+{invoice_total}. The problem I am having is that the results need to be 19 characters, with zeros filling in any characters in the middle. For example:
 
1234567000000234567
 
As always, thanks for your help!


Edited by jbrandes99 - 28 Jun 2011 at 9:52am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 30 Jun 2011 at 3:45am
someone else just had this type of issue
toText({table.account_no},0,"") + toText({table.invoice_total},ReplicateString("0",15))
 
or if that doesn't work
toText({table.account_no},0,"") + toText({table.invoice_total},"000000000000000")
 
this was assuming that account # was 4 long and part of the 19 in length.
you can adjust as needed
 
hopefully 1 of them will work


Edited by lockwelle - 30 Jun 2011 at 3:46am
IP IP Logged
jbrandes99
Newbie
Newbie


Joined: 02 May 2011
Location: United States
Online Status: Offline
Posts: 17
Quote jbrandes99 Replybullet Posted: 30 Jun 2011 at 5:59am
When I try either of these formulas I get "too many arguments have been given to this function"
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 01 Jul 2011 at 3:07am
well, try them one at a time to see which one is bad.  I would suspect the 2nd half, but according to CR's help that should be a valid format string.
IP IP Logged
jbrandes99
Newbie
Newbie


Joined: 02 May 2011
Location: United States
Online Status: Offline
Posts: 17
Quote jbrandes99 Replybullet Posted: 05 Jul 2011 at 6:31am
I trie breaking it down and still get the error when I place
 
toText({table.account_no},0,"")
 
into a new formula.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 06 Jul 2011 at 12:24pm

I assume you're using the correct table and field name from your database.  I suspect that account_no is not a numeric field - that it's a varchar of some sort.  If that's the case, you don't need "toText".

-Dell
IP IP Logged
jbrandes99
Newbie
Newbie


Joined: 02 May 2011
Location: United States
Online Status: Offline
Posts: 17
Quote jbrandes99 Replybullet Posted: 11 Jul 2011 at 9:51am
Genius..that was it..thanks so much for your help!
IP IP Logged
jbrandes99
Newbie
Newbie


Joined: 02 May 2011
Location: United States
Online Status: Offline
Posts: 17
Quote jbrandes99 Replybullet Posted: 20 Jul 2011 at 8:22am
I just noticed in testing that using these formulas only shows the whole number, i.e., $1.05 displays as $001.
 
Need a little more help. I need to display the amount as 105 (no currency symbol or decimal just numbers).
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 20 Jul 2011 at 9:52am
Change the '0' in the ToText call to however many numbers you want to display after the decimal point.
 
-Dell
IP IP Logged
jbrandes99
Newbie
Newbie


Joined: 02 May 2011
Location: United States
Online Status: Offline
Posts: 17
Quote jbrandes99 Replybullet Posted: 20 Jul 2011 at 10:40am
That got the values to display, but I still need to figure out how to get rid of the $ and decimal point from the value. Any takers?
IP IP Logged
Page  of 2 Next >>
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.