I want a report from item and item ledger entry table. if any item quantity >0 then it will show on the report and otherwise, it will not show on the report.
i add data item as a item and indentation as a item ledger entry table.
I want a report from item and item ledger entry table. if any item quantity >0 then it will show on the report and otherwise, it will not show on the report.
i add data item as a item and indentation as a item ledger entry table.
Hi,
That is possible, but what is your question?
I attach my report underneath. I want to print only those records whose qunatity >0 from
it will take data from item ledger entry table when open value is checked and positive is checked.
Later i will do for this following table.
1, item ledger entry table,37- sales line, 113-sales invoice line,5741-transfer line,7322-Posted Whse. Shipment Header
5745-Transfer Shipment Line.
how can i print only quanty>0 value on my report.?
my report will filter according to responsibility center from request option form and then it will check which item is sold and which item is transfered.
It will not show all record.
OBJECT Report 50008 Item Sales and Transfer
{
OBJECT-PROPERTIES
{
Date=08.12.11;
Time=13:59:11;
Modified=Yes;
Version List=;
}
PROPERTIES
{
}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table27;
DataItemTableView=SORTING(No.);
OnPreDataItem=BEGIN
ItemLedgerEntry.SETFILTER(ItemLedgerEntry.“Location Code”,LocationCode);
ItemLedgerEntry.SETFILTER(ItemLedgerEntry.Positive,FORMAT(TRUE));
ItemLedgerEntry.SETFILTER( ItemLedgerEntry.Open,FORMAT(TRUE));
ItemLedgerEntry.SETFILTER(“Item No.”,Item.“No.”) ;
END;
OnAfterGetRecord=BEGIN
WITH ItemLedgerEntry DO BEGIN
IF ItemLedgerEntry.FIND(’-’) THEN BEGIN
REPEAT
IF ItemLedgerEntry.“Item No.”=Item.“No.” THEN BEGIN
Quantity:= Quantity+ItemLedgerEntry.Quantity;
END;
UNTIL ItemLedgerEntry.NEXT<=0;
END;
END;
/////////
IF quantity>0 THEN BEGIN
itemno:= Item.“No.”;
totalquantity:= quantity ;
Description:=Item.Description;
END;
END;
}
SECTIONS
{
{ PROPERTIES
{
SectionType=Header;
SectionWidth=22050;
SectionHeight=846;
}
CONTROLS
{
{ 1000000005;Label ;10500;423 ;4050 ;423 ;CaptionML=ENU=Quantity }
{ 1000000000;Label ;600 ;423 ;3150 ;423 ;CaptionML=ENU=Item Description }
{ 1000000002;Label ;4350 ;423 ;4800 ;423 ;CaptionML=ENU=Item No }
}
}
{ PROPERTIES
{
SectionType=Body;
SectionWidth=22050;
SectionHeight=1269;
}
CONTROLS
{
{ 1000000004;TextBox;10500;0 ;4200 ;423 ;SourceExpr=totalquantity }
{ 1000000001;TextBox;600 ;0 ;3150 ;423 ;SourceExpr=Description }
{ 1000000003;TextBox;4350 ;0 ;4800 ;423 ;SourceExpr=itemno }
}
}
}
}
}
REQUESTFORM
{
PROPERTIES
{
Width=13750;
Height=4950;
}
CONTROLS
{
{ 1000000000;TextBox;5280 ;770 ;4510 ;440 ;InPage=-1;
CaptionML=ENU=Location;
SourceExpr=LocationCode;
TableRelation=Location.Code }
{ 1000000001;Label ;1870 ;770 ;3300 ;440 ;ParentControl=1000000000 }
}
}
REQUESTPAGE
{
PROPERTIES
{
}
CONTROLS
{
}
}
CODE
{
VAR
Slno@1000000000 : BigInteger;
LocationCode@1000000001 : Code[10];
ErrorText@1000000003 : Text[250];
ItemLedgerEntry@1000000004 : Record 32;
totalquantity@1000000005 : BigInteger;
itemno@1000000006 : Code[20];
description@1000000007 : Text[30];
quantity@1000000008 : BigInteger;
BEGIN
END.
}
RDLDATA
{
}
}
You can simply use
Item.CALCFIELDS(Inventory);
Filter on inventory > 0
You can either control this by setting a filter to the item ledger entry like SETFILTER(Quantity,’>0’) or if the quantity you are checking is the one you calculate in the report, then you can do it in the output section with CurrReport.SHOWOUTPUT(Quanity > 0).
Otherwise then allow me to comment on your report in general. It looks like you haven’t received much training on creating NAV reports.
The first thing that caught my eyes what that you use SETFILTER in the OnPreDataItem section. Instead of using SETFILTER, then you should use SETRANGE. It gives much nicer code and you don’t have to use the FORMAT. Like this:
ItemLedgerEntry.SETRANGE("Location Code",LocationCode);
ItemLedgerEntry.SETRANGE(Positive,TRUE);
ItemLedgerEntry.SETRANGE(Open,TRUE);
Otherwise then one of the best ways you can learn about best practice when it comes to NAV development is to look at the standard reports and how it’s done in here.
I would say that this is better way. Except the results are not going to be the same.
The report example is printing out the total of all positive and open item ledger entries, whereas the “Item.CALCFIELDS(Inventory);” is the sum of all item ledger entries, both open and closed, positive and negative.
But I hope that the OP knows which result is the one he needs.