Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum String

Status
Not open for further replies.

sn00pies

Programmer
Jun 30, 2006
12
MY
platform: CR8.5, VB6

fellow experts,

I am using vb to pass 2 parameters into crystal and then i sum the both values by using:

val({Total1}) + val({Total2})

lets just assume Total1 = 1.99, Total2 = 2.98
and the answer is 4.97, yes it gives me a precise answer.

But when i change my regional language in my control panel into EU. The value become
{Total1} = 1,99 and {Total2} = 2,98 .... when i put val({Total1}) it becomes 1.00 ... so in this case when i sum together it becomes 1.00 + 2.00 = 3 (which is incorrect).

I've tried several conversions to apply into this matter like ccur(), cdbl but the crystal report just wouldn't accept it.. any solutions out there i would like to know ... many thanks in advance.

sn00p,

 
The problem is the comma, which is being interpreted by the val() function as a non-numeric character, hence the values of 1 and 2 for val("1,99") and val("2,98").

So change your regional setting back, if that is an option. If you want to switch to European display of decimals and thousands separators, do it with formatting.

If this is not an option I would search the business objects knoeledgebase, someone else has had to have run into this.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"If you have a big enough dictionary, just about everything is a word"
--Dave Barry
 
Why not simply define the two parameters as numeric?

If they are numberic, then there's no need to apply Val() to this...

hth,
- Ido

view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top