Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Format Formula Post Reply Post New Topic
Author Message
KSAnalyst
Newbie
Newbie
Avatar

Joined: 04 Mar 2008
Location: United States
Online Status: Offline
Posts: 29
Quote KSAnalyst Replybullet Topic: Format Formula
     Posted: 30 Apr 2008 at 4:31pm

I am a crystal XI beginner and need help with a formatting formula.

I have copied a custom formula from the Crystal reports XI sample reports and checked the formula with the "x-2" button and get no errors.  the custom formula works in the sample report.  However when I run the report with my data, my formula field returns the actual syntax in the cusom formula instead of formatting the output.  Here is a copy of the custom formula and my return:
 
Function cdStringParamDisplay (param () As String Range, title As String)
dim paramcount as number
dim increment as number
dim outputd as string
dim outputr as string
paramcount = count(param)
Do While paramcount > increment
increment = increment + 1
if maximum(param (increment)) <> minimum(param (increment)) _
then outputr = outputr + minimum(param (increment)) + " to " + maximum( param (increment)) + "\par " _
else outputd = outputd + minimum( param (increment)) + "\par " _
Loop

cdStringParamDisplay = "{\rtf1\ansi\ansicpg1252\deff0\deflang1033}" + _
"{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fswiss\fcharset0 Arial;}}" + _
"{\colortbl ;\red0\green0\blue128;\red191\green165\blue125;}" + _
"\viewkind4\uc1\pard\cf1\b\f0\fs22 " + title + "\cf0\b0\f1\fs16\par" + _
"\par" + _
"\ul\b\fs16 Distinct Entries\ulnone\par" + _
"\cf2 " + _
"\par " + _
outputd + _
"\par " + _
"\cf0 " + _
"\ul\b Range Entries\ulnone\par " + _
"\par " + _
"\cf2 " + _
outputr + _
"}"
End Function
 
Here is what my report returns:
 
{\rtf1\ansi\ansicpg1252\deff0\deflang1033}{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fswiss\fcharset0 Arial;}}{\colortbl ;\red0\green0\blue128;\red191\green165\blue125;}\viewkind4\uc1\pard\cf1\b\f0\fs22 Programs selected for this report:\cf0\b0\f1\fs16\par\par\ul\b\fs16 Distinct Entries\ulnone\par\cf2 \par Chico Community Counseling Center\par \par \cf0 \ul\b Range Entries\ulnone\par \par \cf2 Access to Access - MHSA\par }
 
The bold entries are my selected parameters.
 
could someone help - please,
 
Thank you,
 
K
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 02 May 2008 at 2:02pm

What kind of a field are you displaying this in?  This is Rich Text data, so you may need to put it into a text box rather than just dragging it onto the report.

-Dell
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 02 May 2008 at 3:20pm
Oh yeah - to add onto Dell's comment, make sure you go into Object Properties and click the RTF checkbox so that it converts it properly.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
KSAnalyst
Newbie
Newbie
Avatar

Joined: 04 Mar 2008
Location: United States
Online Status: Offline
Posts: 29
Quote KSAnalyst Replybullet Posted: 05 May 2008 at 7:42am
Hello Brian,

I changed the object properties to RTF format and now the text box is blank in the preview window.

Can you help me out?

Thank you,

K
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