Hello, I've a report that shows simply list of registers from "Item Ledger Entry" table. One of this fields is "Invoice quantity" field. I want to show, in a footer section, the maximum and minimum value from the this field from those shown. How it would the code to do this, please?.
Thanks in advance.
0
Comments
I don't think there is any function or a property which can get the maximum value. :-k
The Only way is to check the "Invoiced Quantity" onaftergetrecord() every time and keep the highest in a variable and display it at the end. :roll:
Thanks.
Define Variable Qty of type Decimal.
Initialize Qty:=0;
onAfterGetrecord()
IF Qty < "invoiced Quantity" THEN
Qty:= "invoiced Quantity";
Display Qty in Footer.
Just be careful how you handle Negative Values if they exist...
could be solved with a Key with Invoiced Quantity as first field. Used in Tables 266, 267 and 268. Use FINDFIRST or FINDLAST in code to get the Min and Max values.
Or you could use GETRANGEMIN and GETRANGEMAX in code when you filtered out the recordset. See Help for details on these functions.
Finally a flowfield could be used with Min or Max in the CalcFormula.
Yeah right.... :!:
For maximum Inv Qty ...
onAfterGetrecord()
IF Qty=0 THEN
Qty := "invoiced Quantity"
ELSE IF Qty < "invoiced Quantity" THEN
Qty:= "invoiced Quantity";
For mimimum Inv Qty....
onAfterGetrecord()
IF Qty1=0 THEN
Qty1 := "invoiced Quantity"
ELSE IF Qty1 > "invoiced Quantity" THEN
Qty1:= "invoiced Quantity";
Hope u dont find ILEs with Invoiced Quantity = 0 !!!!
Initialize Qty:=0;
onAfterGetrecord()
IF Qty < "invoiced Quantity" THEN
Qty:= "invoiced Quantity";
Doesn't runs well, It gave me the last register, not the minimum; any idea please?
CalcFormula = Min(MyTable.MyField) or
CalcFormula = Max(MyTable.MyField)
But oh my foes and oh my friends, it gives a lovely light