Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Display String on a Summary Post Reply Post New Topic
Author Message
gguthrie
Newbie
Newbie


Joined: 06 May 2009
Location: United States
Online Status: Offline
Posts: 13
Quote gguthrie Replybullet Topic: Display String on a Summary
    Posted: 16 Jun 2011 at 11:55am
Hi,
 
I am doing a forumla that returns records, and then I am doing a summary (which is Maximum) on that field and displaying it in the footer of my report. It loops through about 6 rows. 4 of the rows contain numerical data but the other two return null. The reason being if the result is Refused or Don't Know then it equals 0. But I don't want to show a 0, what I want to show is N/A.
 
So I am going to format object on my summary field and to the formula editor next to Display String and I have this entered:
 
If ({command.Result} = "Refused" Or {command.Result} = "Don't Know") Then
"N/A"
;
 
And it works fine. It shows N/A for the two rows where the above argument is correct. The problem is is does not show anything for the other 4 rows when returned. Dor some reason it seems to have either deleted or hidden these results.
 
Any ideas? thanks!
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 16 Jun 2011 at 1:39pm
Are rows 5 and 6 numerical?If not you can't summarize on them.
IP IP Logged
Dewald
Groupie
Groupie
Avatar

Joined: 02 Jun 2011
Location: South Africa
Online Status: Offline
Posts: 47
Quote Dewald Replybullet Posted: 19 Jun 2011 at 11:40pm
try
If ({command.Result} = "Refused" Or {command.Result} = "Don't Know") Then
"N/A"
else
currentfieldvalue
Dewald Botha
http://www.ITClarity.co.za
IP IP Logged
gguthrie
Newbie
Newbie


Joined: 06 May 2009
Location: United States
Online Status: Offline
Posts: 13
Quote gguthrie Replybullet Posted: 20 Jun 2011 at 3:35am
@CircleD, Oddly enough I converted the fields to text and did a Maximum summary because I have four sets of parameters that return 4 colums of different data:
 
0   52  0   0
34 0    0   0
0   0    0   12
0   0    62 0
 
So I just use the max and put the results in the footer as only one value can be chosen for each column.
 
And thanks Dewald. That worked if I used Totext.
 
If ({command.Result} = "Refused" Or {command.Result} = "Don't Know") Then
"N/A"
else
Totext (currentfieldvalue);
 
Thanks all!
IP IP Logged
Dewald
Groupie
Groupie
Avatar

Joined: 02 Jun 2011
Location: South Africa
Online Status: Offline
Posts: 47
Quote Dewald Replybullet Posted: 20 Jun 2011 at 8:26pm
Yes of course, I missed that. Both parts of an if statement  must return the same data type.
Dewald Botha
http://www.ITClarity.co.za
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.016 seconds.