HomeForum
Welcome, Guest

Number conversion problem
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: Number conversion problem

Number conversion problem 1 year, 5 months ago #1265

  • cmarra
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
  • Karma: 0
Hi,

I'm trying to use this simple calculation

Begin
Result:= StrToFloat([F001]) - StrToFloat([F002]);
End;

but the result is always null.

I suspect the problem is the number format: decimal separator is coma.

Thank you for the support

Re: Number conversion problem 1 year, 5 months ago #1266

  • admin
  • OFFLINE
  • Moderator
  • Posts: 2174
  • Karma: 12
Download latest version and use

begin
result:=StrToFloat(Replace([F001],',','.'))+StrToFloat(Replace([F002],',','.'));
end;

Peter

Re: Number conversion problem 1 year, 5 months ago #1267

  • cmarra
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
  • Karma: 0
The problem is the number string which is like 0000120,45

The replace function works well with the decimal separator but the string conversion function does not manage the leading zeros; also tried with Ensure no prefix function but I guess it requires the exact number of leading zeros...

Any suggestion?

Re: Number conversion problem 1 year, 5 months ago #1268

  • admin
  • OFFLINE
  • Moderator
  • Posts: 2174
  • Karma: 12
Just tested it again with version 3.2.2.13

It does work

I've even put spaces in front of 0000120,45

Mike

Re: Number conversion problem 1 year, 5 months ago #1269

  • cmarra
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
  • Karma: 0
Ok, it works!!!

Maybe it's my fault; what I changed since last time is the 'on error' behavior in the calculation properties: when set to 'Set to Null' calculation fails (it always returns null) but it works fine when set to 'Abort processing'.

Thank you

Re: Number conversion problem 1 year, 5 months ago #1278

  • cmarra
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
  • Karma: 0
Sorry but calculation function is not working well when numeric inputs are like '0000111'

Separator replacement is ok, the StrToFloat function maybe not, see the attached file

bye
C.
Screen.png
  • Page:
  • 1
  • 2
Time to create page: 0.19 seconds

Testimonials

"This [Visual Importer ETL] is such a great help. As expected, it has paid for itself within one week!"

Phill Stive,
Oracle DBA, OU,
Newcaste

User Login

You only need to log in or register to use our support forum



Our customers

BP

BBC

HSBC


Databases we work with

Go to top