Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Value without punctuation Post Reply Post New Topic
Author Message
Gurbs
Senior Member
Senior Member
Avatar

Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Quote Gurbs Replybullet Topic: Value without punctuation
     Posted: 17 Feb 2012 at 2:43am
Hi all,

I am working in CR to create an overview for a bank. I want to export the file into a text file.
The problem I'm having, is with the values of the transactions. I want the value to show, but without punctuation. For example, if the value is 220.58, I want it to show like 22058. I want to keep the numbers behind the comma, but I want the comma to disappear.

Besides this, I would like to have a + in front of the value when it is positive, and a - if it is negative.

Can someone help me with this?

Thank you in advance

Kind regards

Gerben
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 17 Feb 2012 at 4:00am

Try this;

 
 
if {table.field} < 0
then
"-" & totext(abs({table.field}*100),0,"")
else
"+" & totext(abs({table.field}*100),0,"")
 
 
You could also just do {table.field} * 100 and play around with the field formatting if you want to keep the field as a number datatype.
 
Regards,
Ryan.


Edited by rkrowland - 17 Feb 2012 at 4:10am
IP IP Logged
Gurbs
Senior Member
Senior Member
Avatar

Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Quote Gurbs Replybullet Posted: 17 Feb 2012 at 4:14am
Thanks for the reply Ryan, it works again. Only, I had a formula that stated the field had to be 8 characters long.
Right('00000000' & {table.field},8);

Can you please tell me how to get the right output?

Thanks alot
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 17 Feb 2012 at 4:17am
(if {table.field} < 0
then
"-"
else
"+")
& right("00000000" & totext(abs({table.field}*100),0,""),8)
 
That would return 9 characters in total (including the +/-) change the 8 to 7 if you want 8 in total including +/-.
 
Regards,
Ryan.



Edited by rkrowland - 17 Feb 2012 at 4:20am
IP IP Logged
Gurbs
Senior Member
Senior Member
Avatar

Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Quote Gurbs Replybullet Posted: 17 Feb 2012 at 4:39am
Works great, thanks again!
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