It find date, but that isn't Min date - it's first date in table.
For example - I have data in table like this:
......18.12.15
......19.11.15
......03.12.15
Code find date 18.12.15, but should be 19.11.15
ProductionOrderLine.RESET;
ProductionOrderLine.SETCURRENTKEY("Ending Date",Status,"Item No.","Location Code");
ProductionOrderLine.SETFILTER(Status,'%1..%2',ProductionOrderLine.Status::Planned,ProductionOrderLine.Status::Released);
ProductionOrderLine.SETFILTER(ProductionOrderLine.Quantity,'>0');
ProductionOrderLine.SETRANGE("Item No.",Item."No.");
ProductionOrderLine.SETRANGE("Location Code", "Sales Line"."Location Code");
IF NOT ProductionOrderLine.FINDFIRST THEN
CLEAR(ProductionOrderLine)
ELSE
mindate := ProductionOrderLine."Ending Date";
If i add there "Ending Date" (ProductionOrderLine.SETCURRENTKEY("Ending Date",Status,"Item No.","Location Code");), then i get error message:
"The Prod. Order Line table doesn't have an active key that starts with the following field or fields: Ending date, Status, Item No., Location Code."
Comments
prodorderline.setcurrentkey([a key that begins with ending date field]);
prodorderline.findfirst;
mindate := prodorderline."ending date";
clear(prodorderline);
prodorderline.setrange("ending date",mindate);
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
ProductionOrderLine.RESET;
ProductionOrderLine.SETCURRENTKEY(Status,"Item No.","Location Code");
ProductionOrderLine.SETFILTER(Status,'%1..%2',ProductionOrderLine.Status::Planned,ProductionOrderLine.Status::Released);
ProductionOrderLine.SETFILTER(ProductionOrderLine.Quantity,'>0');
ProductionOrderLine.SETRANGE("Item No.",Item."No.");
ProductionOrderLine.SETRANGE("Location Code", "Sales Line"."Location Code");
IF NOT ProductionOrderLine.FINDFIRST THEN
CLEAR(ProductionOrderLine);
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
ProductionOrderLine.RESET;
ProductionOrderLine.SETCURRENTKEY(Status,"Item No.","Location Code","Ending Date");
...
but what next?
ProductionOrderLine.SETCURRENTKEY("Ending Date",Status,"Item No.","Location Code");
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
mindate := prodorderline."ending date";
mindate date will have smallest ending date
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
In which place will be this?
prodorderline.findfirst;
mindate := prodorderline."ending date";
That is full code.
ProductionOrderLine.RESET;
ProductionOrderLine.SETCURRENTKEY("Ending Date",Status,"Item No.","Location Code");
ProductionOrderLine.SETFILTER(Status,'%1..%2',ProductionOrderLine.Status::Planned,ProductionOrderLine.Status::Released);
ProductionOrderLine.SETFILTER(ProductionOrderLine.Quantity,'>0');
ProductionOrderLine.SETRANGE("Item No.",Item."No.");
ProductionOrderLine.SETRANGE("Location Code", "Sales Line"."Location Code");
IF NOT ProductionOrderLine.FINDFIRST THEN
CLEAR(ProductionOrderLine);
CLEAR(ProductionOrderLine)
ELSE
mindate := prodorderline."ending date";
Is it a report or where do you need minimum ending date?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
For example - I have data in table like this:
......18.12.15
......19.11.15
......03.12.15
Code find date 18.12.15, but should be 19.11.15
ProductionOrderLine.RESET;
ProductionOrderLine.SETCURRENTKEY("Ending Date",Status,"Item No.","Location Code");
ProductionOrderLine.SETFILTER(Status,'%1..%2',ProductionOrderLine.Status::Planned,ProductionOrderLine.Status::Released);
ProductionOrderLine.SETFILTER(ProductionOrderLine.Quantity,'>0');
ProductionOrderLine.SETRANGE("Item No.",Item."No.");
ProductionOrderLine.SETRANGE("Location Code", "Sales Line"."Location Code");
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
ProductionOrderLine.RESET;
ProductionOrderLine.SETCURRENTKEY("Ending Date",Status,"Item No.","Location Code");
ProductionOrderLine.SETFILTER(Status,'%1..%2',ProductionOrderLine.Status::Planned,ProductionOrderLine.Status::Released);
ProductionOrderLine.SETFILTER(ProductionOrderLine.Quantity,'>0');
ProductionOrderLine.SETRANGE("Item No.",Item."No.");
ProductionOrderLine.SETRANGE("Location Code", "Sales Line"."Location Code");
IF NOT ProductionOrderLine.FINDFIRST THEN
CLEAR(ProductionOrderLine)
ELSE
mindate := ProductionOrderLine."Ending Date";
If i add there "Ending Date" (ProductionOrderLine.SETCURRENTKEY("Ending Date",Status,"Item No.","Location Code");), then i get error message:
"The Prod. Order Line table doesn't have an active key that starts with the following field or fields: Ending date, Status, Item No., Location Code."
if not then create One
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav