Print Page | Close Window

Text instead of Number

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=18268
Printed Date: 14 May 2024 at 3:59am


Topic: Text instead of Number
Posted By: stevetothink
Subject: Text instead of Number
Date Posted: 14 Dec 2012 at 3:31am
Anyone know how to correct the formula below so I don't get the error "A number is required here"
 
if( mailto:%7b@Div - {@Div Equiv Code})="A" then ({#RTSharesVested}*3.64)

else
if( mailto:%7b@Div - {@Div Equiv Code})="C" then ({#RTSharesVested}*3.64)

else "See chart on next page" <----I Get the error on this text

Thanks,
Steve



Replies:
Posted By: kevlray
Date Posted: 14 Dec 2012 at 8:18am
You will have to convert your calculations to text.  All results from an if statement have to be the same data type.

if( mailto:%7b@Div - {@Div Equiv Code})="A" then totext({#RTSharesVested}*3.64)

else
if( mailto:%7b@Div - {@Div Equiv Code})="C" then totext({#RTSharesVested}*3.64)

else "See chart on next page"


Posted By: stevetothink
Date Posted: 14 Dec 2012 at 9:12am
Thanks - if I convert them to text can I sum the numbers still?


Posted By: kevlray
Date Posted: 14 Dec 2012 at 11:37am
Nope.  But with the last else, how would you sum the string?  You may need come up with an alternate way to get the sum (there are several possibilities).



Print Page | Close Window