views:

259

answers:

2

Hi friends, I put the following formula in Custom Style->Decimals

Local stringVar strCadena :=ToText(cdbl({ado.ValorCliente}) - Truncate ({ado.ValorCliente}, 0)); Length (strCadena) - 2

But the report set 2 decimal for this operation ( 2 is equal to the setting configured in Regional Settings of my computer) cdbl({ado.ValorCliente}) - Truncate ({ado.ValorCliente}, 0)

Is there a way to avoid the regional settings?

Thanks in advance. Talo

A: 

So you're trying to display a numeric field in Crystal using the same precision as it was recorded in? 1.9, 2.3451, 23456.650000006, etc? Assuming that the divider between the integer part of the number and the decimals is always a decimal point, this should work :

Local NumberVar dotPos := InstrRev({ado.ValorCliente}, ".");
If dotPos = 0 Then
    0 //returning 0
Else
    Len({ado.ValorCliente}) - dotPos
CodeByMoonlight
I'm using Crystal Report 8.5. and Len() function only accepts a string parameter. Then I used ToText() for data type conversion but crystal round my number with 2 decimal digits (Regional settings). I think I'm going to modify my query and return the numeric fields like string.
Talo
A: 

i have 3 columns in crystal report such as stock, costprize and amount in default i have fetched value of stock and costprz from table , then i want to calculate the amount using following formula numberVar amount := ({itm_master.stock} * {itm_master.costprice});

it works fine but following values it shows wrongly ex

if stock = 17.00 and costprz = 945.14 the results shows 16,067.32

but actual result ls 16,067.38

how to fix this problem pls help me

shahul