juanjo.mauriz
Participante
juanjo.mauriz

Hola, buenas tardes.

Gracias por contestar y perdón por no poner el código, pero me pillo la mente saturada y lo primero que hay que hacer, no lo hice. Sorry.

Te paso el código y ya me dices, si es posible, donde me falta algo o que me sobra jejeje

En el  “OnInitReport”…

trigger OnInitReport()
begin
        …

        xVisible1 := true;
        xVisible2 := true;
        xVisible3 := true;
        xVisible4 := true;
        xVisible5 := true;
        xVisible6 := true;  

        …

end;

En el “procedure” global…

local procedure CambiarVisibleF(pOption: Option)
begin
xVisible1 := false;
xVisible2 := false;
xVisible3 := false;
xVisible4 := false;
xVisible5 := false;
xVisible6 := false;
case pOption of
0:
begin
xVisible1 := true;
xVisible2 := true;
xVisible3 := true;
xVisible4 := true;
xVisible5 := true;
xVisible6 := true;
TipoFiltro := ‘A’;
end;
1:
begin
xVisible1 := true;
TipoFiltro := ‘B’;
end;
2:
begin
xVisible2 := true;
TipoFiltro := ‘C’;
end;
3:
begin
xVisible3 := true;
TipoFiltro := ‘D’;
end;
4:
begin
xVisible4 := true;
TipoFiltro := ‘E’;
end;
5:
begin
xVisible5 := true;
TipoFiltro := ‘F’;
end;
6:
begin
xVisible6 := true;
TipoFiltro := ‘G’;
end;
end;
end;

En las “Var” globales…

var

xOption: Option A,B,C,D,E,F,G;
xVisible1: boolean;
xVisible2: boolean;
xVisible3: boolean;
xVisible4: boolean;
xVisible5: boolean;
xVisible6: boolean;
xReferencia: Code[20];
xCliente: Code[20];
xZona: Code[20];
xComercial: Code[20];
xGrupo_compras: Code[20];
xFamilia: Code[20];
TipoFiltro: Text;

En el requestpage…

requestpage
{
SaveValues = true;
layout
{
area(Content)
{


group(GroupName)
{
caption = ‘Filtros de busqueda’;
field(OptionGrupos; xOption)
{
ApplicationArea = all;
caption = ‘Elegir grupo para filtro’;
OptionCaption = ‘Todos,Referencia,Cliente,Zona,Comercial,Grupo de compras,Familia’;
trigger OnValidate()
begin
CambiarVisibleF(xOption);
Message(Format(xVisible1) + Format(xVisible2) + Format(xVisible3) + Format(xVisible4) + Format(xVisible5) +                                                          Format(xVisible6) + TipoFiltro);  //   <——- ESTE “MESSAGE” SACA LOS DATOS CORRECTOS
RequestOptionsPage.Update();
end;

}
group(Articulo)
{
Visible = xVisible1;
caption = ‘Referencia’;
field(Campo1; xReferencia)
{
ApplicationArea = all;
Caption = ‘Referencia de articulo’;
ToolTip = ‘Referencia de articulo’;
Lookup = true;
TableRelation = Item;
}
}
group(Cliente)
{
Visible = xVisible2;
caption = ‘Cliente’;
field(Campo2; xCliente)
{
ApplicationArea = all;
Caption = ‘Código de cliente’;
ToolTip = ‘Código de cliente’;
Lookup = true;
TableRelation = Customer;
}
}

//Y así con el resto de grupos a mostrar, donde esto lo hace perfectamente.

}
}
}
actions
{
area(processing)
{
action(ActionName)
{
ApplicationArea = All;
}
}
}

Y por último en el “OnPreReport” que es donde me falla…

trigger OnPreReport()
var
rlItem: record Item;
rlItemledgerEntry: record “Item Ledger Entry”;
xTotalActual: decimal;
xTotalAnterior: decimal;
begin

Message(Format(xVisible1) + Format(xVisible2) + Format(xVisible3) + Format(xVisible4) + Format(xVisible5) + Format(xVisible6) +

TipoFiltro); // <———- SIEMPRE PONE LOS VALORES DEL “OnInitReport” y  no los modificados en el “Resquetpage”.

Fecha := Format(StartDate) + ‘..’ + Format(EndDate);
Fecha1 := Format(StartDate1) + ‘..’ + Format(EndDate1);
if rlItem.FindSet(false) then begin
repeat

if TipoFiltro = ‘A’ then begin
rlItem.setfilter(“No.”, xReferencia);
rlitemledgerentry.setfilter(“Source No.”, xCliente);
rlitemledgerentry.setfilter(“Global Dimension 2 Code”, xZona);
rlitemledgerentry.setfilter(“Shortcut Dimension 5 Code”, xComercial);
rlitemledgerentry.setfilter(“Global Dimension 1 Code”, xGrupo_Compras);
rlitemledgerentry.setfilter(“Item Category Code”, xFamilia);
end;
if TipoFiltro = ‘B’ then begin
rlItem.setfilter(“No.”, xReferencia);
end;
if TipoFiltro = ‘C’ then begin
rlitemledgerentry.setfilter(“Source No.”, xCliente);
end;
if TipoFiltro = ‘D’ then begin
rlitemledgerentry.setfilter(“Global Dimension 2 Code”, xZona);
end;
if TipoFiltro = ‘E’ then begin
rlitemledgerentry.setfilter(“Shortcut Dimension 5 Code”, xComercial);
end;
if TipoFiltro = ‘F’ then begin
rlitemledgerentry.setfilter(“Global Dimension 1 Code”, xGrupo_Compras);
end;
if TipoFiltro = ‘G’ then begin
rlitemledgerentry.setfilter(“Item Category Code”, xFamilia);
end;


rTableAxuliarReport.Init();
xlinea += 1;
rTableAxuliarReport.CodProducto := rlitem.”No.”;
rTableAxuliarReport.descripcion := rlitem.Description;
rTableAxuliarReport.Cantidad1 := xTotalActual;
rTableAxuliarReport.Cantidad2 := xTotalAnterior;
rTableAxuliarReport.Insert(false);
until rlItem.Next() = 0;
end;
end;

Y hay se me acaban las ideas…

Gracias por tu colaboración, creo que no me he dejado nada de código que forme parte de lo que quiero hacer.

NOTA: El código no esta depurado, solo es para que funcione, luego ya vendré con las depuraciones para que sea mas legible y rápido, pero ahora solo es para que funcione, ya que AL no entiendo y tengo que hacerlo lo mas detallado posible para poder enterderlo.

Saludos y espero tus comentarios con agradecimiento!!!

#1020557