HomeForum
Welcome, Guest

Mathematical Calculation within Transformation
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Mathematical Calculation within Transformation

Mathematical Calculation within Transformation 1 year, 2 months ago #2032

Hi,

I am attempting to calculate an award payout based on two dynamic input values. I am trying this via the calculation object within a transformation. I have tried the following but cannot get it to work. Any help is appreciated.

begin
if (StrToFloat([F001])/StrToFloat([F002]))*100 is >= 90 and < 95 then
Result := (StrToFloat([F001]) * .01
else if (StrToFloat([F001])/StrToFloat([F002]))*100 is >= 95 and < 100 then
Result := (StrToFloat([F001]) * .01125
else if (StrToFloat([F001])/StrToFloat([F002]))*100 is >= 100 and < 105 then
Result := (StrToFloat([F001]) * .0125
else if (StrToFloat([F001])/StrToFloat([F002]))*100 is >= 105 then
Result := (StrToFloat([F001]) * .015
else
Result := 0
end;

Thanks

Re: Mathematical Calculation within Transformation 1 year, 2 months ago #2035

  • admin
  • NOW ONLINE
  • Moderator
  • Posts: 2182
  • Karma: 12
You have made it far too complicated

begin
if ([F001]/[F002])*100 >= 90 and ([F001]/[F002])*100 < 95 then
Result := [F001] * 0.01
else if ([F001])/[F002])*100 >= 95 and ([F001])/[F002])*100 < 100 then
Result := [F001] * 0.01125
else if ([F001]/[F002])*100 >= 100 and ([F001]/[F002])*100 < 105 then
Result := [F001] * 0.0125
else if ([F001]/[F002])*100 >= 105 then
Result := [F001] * 0.015
else
Result := 0;
end;

Start from simple than slowly increase complexity

Mike
  • Page:
  • 1
Time to create page: 0.16 seconds

Testimonials

"DBSL software makes it much easier for us to enable new customers for automatic order processing. This alone sets us apart from the competition."

M. Clock, Director,
Clock Logistics

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