Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Formula for Enable Currency Symbol Post Reply Post New Topic
Author Message
ejh21
Newbie
Newbie
Avatar

Joined: 08 Dec 2010
Location: United States
Online Status: Offline
Posts: 8
Quote ejh21 Replybullet Topic: Formula for Enable Currency Symbol
    Posted: 20 Dec 2010 at 8:10am
I am trying to create a formula that will decide whether or not to show a floating Currency Symbol in a field in my detail band.

The currency symbol should show depending on the value of a field in my group header. For instance, if the value of my field in the group header is blank, then the field in the detail band should show a $. Unless this field is not in the detail band where the row description is not a balance.

Here is my example data:

Row Description        Amount
Beginning Balance      1000.00
Contributions                 10.00
Ending Balance          1010.00

The 1st and 3rd rows should have the $ if the character field in the group header is blank. SourceName is the character field in the group header.

Here is my code:

if SourceName = "" then
select RowDescription
    case "Beginning Balance" : crFloatingCurrencySymbol
    case "Ending Balance" : crFloatingCurrencySymbol
    default : crNoCurrencySymbol
else crNoCurrencySymbol

I have the currency symbol enabled and it is set to floating. I have this code placed in the formula box beside "Enable Currency Symbol". I've tried every combination of changing the defaults, but the field in the detail always shows the currency symbol for some reason, instead of only showing for the rows that it should. Could anyone let me know if my code looks correct?

Thanks,
Erik
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 20 Dec 2010 at 9:08am
What method did you choose to display the row descriptions?
IP IP Logged
ejh21
Newbie
Newbie
Avatar

Joined: 08 Dec 2010
Location: United States
Online Status: Offline
Posts: 8
Quote ejh21 Replybullet Posted: 20 Dec 2010 at 9:12am
The Row Descriptions are a field in the same detail section where I am displaying the amount.
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 20 Dec 2010 at 9:16am
I'm trying to reproduce something like that to get an idea what might be wrong, but I'm not sure what kind of field the RowDescription is.
IP IP Logged
ejh21
Newbie
Newbie
Avatar

Joined: 08 Dec 2010
Location: United States
Online Status: Offline
Posts: 8
Quote ejh21 Replybullet Posted: 20 Dec 2010 at 9:17am
This code works when not factoring in the Group Header field to be blank.

select RowDescription
    case "Beginning Balance" : crFloatingCurrencySymbol
    case "Ending Balance" : crFloatingCurrencySymbol
    default : crNoCurrencySymbol

This code will show the $ symbol if RowDescription is Beginning of Ending Balance and no symbol shows otherwise. However, when I include the other factor of the Group Header field being blank, it seems to just revert to what is set in the default settings.
IP IP Logged
ejh21
Newbie
Newbie
Avatar

Joined: 08 Dec 2010
Location: United States
Online Status: Offline
Posts: 8
Quote ejh21 Replybullet Posted: 20 Dec 2010 at 9:18am
I'm sorry. It's a character field from a table just as Amount is a numeric field from the same table. The field in the group header, "SourceName", is also a character field.
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 20 Dec 2010 at 9:21am
So then the question becomes...are they really "blank"?
It's possible that they're something else, like maybe a null char. I'm not too sure about how default values work, but that has gotten me a couple times when I assumed a field would be the empty string when it was in fact null..

Maybe you can use


if IsNull(row_description)


instead and see if it works.

EDIT: I mean group header.

Edited by Keikoku - 20 Dec 2010 at 9:26am
IP IP Logged
ejh21
Newbie
Newbie
Avatar

Joined: 08 Dec 2010
Location: United States
Online Status: Offline
Posts: 8
Quote ejh21 Replybullet Posted: 20 Dec 2010 at 9:40am
That's what it was. Thank you so much! I have been looking at this for hours wondering what it could be.
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.048 seconds.