In Navision (pascal for that matter) there is a command that returns the whole number of a decimal value by truncating the remainder. It is a seldom used command and I can’t seem to remember what it is called. I believe there is also a command to get the remainder value as well. I know that I could write my own function to do this but, if there is any easy command… Any help? Bill Benefiel Manager of Information Systems Overhead Door Company billb@ohdindy.com (317) 842-7444 ext 117 Edited by - wbenefiel on 2002 Jan 16 21:06:02

Try ROUND(a/b,1,’<’). This would Round down to the nearest Whole Number. Chris Krantz NCSD,NCSQL,MCSD,MCSE Microforum Inc. Toronto, Ontario, Canada

Thanks Chris but, for my application I don’t want to round at all. I just want to truncate the remainder of one value and then retrieve the remainder into another variable i.e. myvalue := 11.89; I’ll stress again I am not interested in programming solutions. I am able to write one myself. I just don’t want to write a bunch of code where a simple command will do. lesstheremainder := somecommand(myvalue); // = 11 lessthewholenumber := somecommand(myvalue); // = 89; Bill Benefiel Manager of Information Systems Overhead Door Company billb@ohdindy.com (317) 842-7444 ext 117 Edited by - wbenefiel on 2002 Jan 16 21:16:22

Rounding Down to the nearest whole number is truncating I would just use: WholeNumber = ROUND(myValue,1,’<’); [11] DecimalNumber = myValue - WholeNumber; [0.89] (You have multipled it by 100 to get an ingeter…You can do that here too) The terminology of the Function might not be the best, but I think the result is what you are looking for. Chris.

Bill, I played around with the Format function to see if that would be useful, but the output is a string and the decimal portion comes out as “.89” (using your example of 11.89). So I would guess Chris’ approach is probably the best answer in C/AL. Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner

You may be refering to the operators ‘DIV’ and ‘MOD’. Using ‘DIV’ as an operator gives you the integer result of division. The ‘MOD’ operator gives you the remainder.

Thanks Bob, that is exactly what I was looking for. Bill Benefiel Manager of Information Systems Overhead Door Company billb@ohdindy.com (317) 842-7444 ext 117

I believe the MOD result still comes up with a Decimal, rather than Integer, value. Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner

It depends on the data type you use to hold the result. If it is defined as an integer the value will be converted to an integer.

If I write the following code with Y defined Decimal and Z defined Integer Y := 11.89; Z := Y MOD 1; I get the error message Overflow under type code of Decimal to Integer. Value: 0.89 If I change the second statement to Z := Y MOD 1.0; nothing changes. But if I define Z as decimal the result is that it executes and Z equals 0.89. So I’m not able to reproduce what you’re describing Bob. Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner

The MOD and DIV commands only work for Integers: 38 DIV 7 = 5; 38 MOD 7 = 3; What Bill is looking for: TRUNC(11.89) = 11.0 FRAC(11.89) = 0.89 These Pascal-functions are not implemented in Navision. However … **Round(100*11.89) MOD 100 = 89** With best regards from Switzerland **Marcus Fabian**

Another way - Wholenumber and Remainder are textfields - now you can use variable number of decimals Wholenumber := format(decimal DIV 1); Remainder := DELSTR(format(decimal MOD 1),1,2);

Well… if having more than 2 decimal places your examples wouldn’t work… why don’t trying something easier: Number := whateverdecimalvalue; Fraction := Number - ROUND(number,1,’<’); wholenumber := ROUND(number,1,’<’); Regards Alfonso Pertierra (Spain)apertierra@teleline.es