Excelent day for everyone. I am creating collections and then counting rows, I do all this in the onstart property.
It happens that when I use the collections it counts incorrectly but when I use the sharepoint list it counts correctly.
Why is this happening?
Is it correct that I create collections if I am going to work directly in onstart?
Can my code be reduced further?
Am I using the coalesce function correctly?
Concurrent(
ClearCollect(
colDBPartidasLecciones;
ShowColumns(
DBPartidasLecciones;
"ETAPA_x0020_DE_x0020_EJECUCI_x00";
"PARTIDA2"
)
);
ClearCollect(
colDBProyectos;
ShowColumns(
DBProyectos;
"Listadeproyectos"
)
);
ClearCollect(
col1;
Sort(
ListaTrabajadores;
ID;
SortOrder.Ascending
)
);
ClearCollect(
col2;
Sort(
ListaTrabajadores;
ID;
SortOrder.Descending
)
);
ClearCollect(
colListaContratistas;
ShowColumns(
ListaContratistas;
"Title"
)
);
ClearCollect(
colHorasHombres;
ShowColumns(
HorasHombre;
"Proyecto";
"MES";
"HorasMensuales"
)
);
ClearCollect(
colFlashReport;
FlashReport
);
ClearCollect(
colEntregablesAccidentes;
ShowColumns(
EntregablesAccidentes;
"Estado";
"Codigo"
)
);
ClearCollect(
colListaEntregablesAccidentes;
ShowColumns(
ListaEntregablesAccidents;
"Entregables"
)
);
ClearCollect(
colDBOPT;
ShowColumns(
DBOPT;
"Proyecto";
"Fecha"
)
)
);;
Concurrent(
ClearCollect(
colListaTrabajadores;
col1;
Filter(
col2;
Not(ID in col1.ID)
)
);
With(
{
wFilterAC: Filter(
colFlashReport;
((TipoAccidente = "Accidente Leve" || TipoAccidente = "Accidente Incapacitante") And FechaHora >= DateValue("01/01/2023"))
)
};
Coalesce(
Set(
varAcAm;
CountRows(
Filter(
wFilterAC;
Proyecto = "Amancae"
)
)
);
(Set(
varAcAq;
CountRows(
Filter(
wFilterAC;
Proyecto = "Aquilaria"
)
)
));
(Set(
varAcGar;
CountRows(
Filter(
wFilterAC;
Proyecto = "Gardenia"
)
)
));
(Set(
varAcSau;
CountRows(
Filter(
wFilterAC;
Proyecto = "Sauco"
)
)
))
)
);
With(
{
wFilterACOct: Filter(
colFlashReport;
((TipoAccidente = "Accidente Leve" || TipoAccidente = "Accidente Incapacitante") And FechaHora >= DateValue("01/10/2023"))
)
};
Coalesce(
Set(
varAcOctAm;
CountRows(
Filter(
wFilterACOct;
Proyecto = "Amancae"
)
)
);
(Set(
varAcOctAq;
CountRows(
Filter(
wFilterACOct;
Proyecto = "Aquilaria"
)
)
));
(Set(
varAcOctGar;
CountRows(
Filter(
wFilterACOct;
Proyecto = "Gardenia"
)
)
));
(Set(
varAcOctSau;
CountRows(
Filter(
wFilterACOct;
Proyecto = "Sauco"
)
)
))
)
);
With(
{
wFilterInc: Filter(
colFlashReport;
(TipoAccidente = "Incidente" And FechaHora >= DateValue("01/01/2023"))
)
};
Coalesce(
Set(
varInAm;
CountRows(
Filter(
wFilterInc;
Proyecto = "Amancae"
)
)
);
(Set(
varInAq;
CountRows(
Filter(
wFilterInc;
Proyecto = "Aquilaria"
)
)
));
(Set(
varInGar;
CountRows(
Filter(
wFilterInc;
Proyecto = "Gardenia"
)
)
));
(Set(
varInSau;
CountRows(
Filter(
wFilterInc;
Proyecto = "Sauco"
)
)
))
)
)
)
When I change colFlashReport to FlashReport, which is the file that is in sharepoint, it gives me the appropriate result.
very grateful for your support
Very grateful for your answers.