Avatar
Cristina Nicolàs
Superadministrador
Cristina Nicolàs

Te paso un ejemplo de una query que desarrollé con NAV2013 a modo de pruebas, que es la que precisamente después recorro con ese código de la respuesta anterior.

OBJECT Query 50000 My First Query
{
OBJECT-PROPERTIES
{
Date=04/11/12;
Time=21:23:26;
Modified=Yes;
Version List=;
}
PROPERTIES
{
}
ELEMENTS
{
{ 1100286000;;DataItem; ;
DataItemTable=Table32;
DataItemTableFilter=Entry Type=CONST(Sale) }

{ 1100286002;1;Column; ;
DataSource=Item No. }

{ 1100286003;1;Column; ;
DataSource=Posting Date;
MethodType=Date;
Method=Month }

{ 1100286004;1;Column; ;
DataSource=Quantity;
ReverseSign=Yes;
MethodType=Totals;
Method=Sum }

{ 1100286005;1;Column; ;
DataSource=Source No. }

{ 1100286001;1;DataItem; ;
DataItemTable=Table27;
DataItemLink=No.=Item_Ledger_Entry.»Item No.» }

{ 1100286006;2;Column; ;
DataSource=Description }

{ 1100286007;2;DataItem; ;
DataItemTable=Table18;
DataItemLink=No.=Item_Ledger_Entry.»Source No.» }

{ 1100286008;3;Column; ;
DataSource=Name }

{ 1100286009;3;Column; ;
DataSource=Customer Posting Group }

}
CODE
{

BEGIN
END.
}
}

Y la función que la recorre:

PROCEDURE QueryFunction@1100286001();
VAR
MyFirstQuery@1100286000 : Query 50000;
BEGIN
MyFirstQuery.OPEN;
WHILE MyFirstQuery.READ DO
OutputData(MyFirstQuery.Item_No,
MyFirstQuery.Month_Posting_Date,
MyFirstQuery.Sum_Quantity,
MyFirstQuery.Source_No,
MyFirstQuery.Description,
MyFirstQuery.Name,
MyFirstQuery.Customer_Posting_Group);
END;

PROCEDURE OutputData@1100286000(ItemNo@1100286006 : Code[10];Month@1100286000 : Integer;QuantitySum@1100286001 : Decimal;SourceNo@1100286002 : Code[10];ItemDescription@1100286003 : Text[50];CustomerName@1100286004 : Text[50];CustomerPostingGroup@1100286005 : Code[10]);
BEGIN
Counter := Counter + 1;
END;

#13146