Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Problem with formula and special character Post Reply Post New Topic
Author Message
guht
Newbie
Newbie


Joined: 23 Jun 2008
Online Status: Offline
Posts: 1
Quote guht Replybullet Topic: Problem with formula and special character
    Posted: 23 Jun 2008 at 11:55am

Im using crystal 9.5 and the database connection is using a microsoft access database and the syntax is crystal.

Field1 and Field2 are both set to type Text in the MSACCESS database.

The below formula is looking to see if either Field1 or Field2 is populated with the "-" symbol.

If it is then display Field3 with a "- " in front of it.
If it doesnt then just display Field3.

It worked fine up until the MSACESS database Field1 and Field2 contained a "+" as its data.

It still displays the "-" symbol, but for data fields containing "+" it doesnt display anything, but it should display the else portion of the statement, which is simply Field3 by itself.

How do I write the below formula so it displays "-" + Field3 when either Field1 OR Field2 contain "-", and display Field3 alone when Field1 or Field2 contains "+"


Formula:
If (Cstr({rpSxData.Field1}) = "-" OR Cstr({rpSxData.Field2}) = "-") then
    "- " + {rpSxData.Field3}
else
    {rpSxData.Field3}

Thanks!



IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 23 Jun 2008 at 11:44pm
That's really odd. I have no idea what is causing the problem, but one thing confuses me: Why are you using CStr() function around the fields in the If condition. Aren't they already strings and thus you don't need to convert them? And if they aren't then what data type are they?

As a wild guess, I would also use CStr() around the field in the Else statement to force it to be a string.
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
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.