Fórum Como faz a contagem dos registro da Query Detail em uma relação Master/Detail? #619874
24/04/2023
0
Eu tentei fazer essa contagem em todos os eventos "After" do componente TFDQuery tento da Query Master como da Query Detail, "AfterExecute", "AfterOpen", "AfterRefresh" "AfterScroll"
if DMP.QueryP03B_.RecordCount <= 0 then begin frmPrincipal.EplblListagenItens.Caption := '0 Itens Listados'; end else if DMP.QueryP03B_.RecordCount = 1 then begin frmPrincipal.EplblListagenItens.Caption := '1 Item Listado'; end else if DMP.QueryP03A_.RecordCount > 1 then frmPrincipal.EplblListagenItens.Caption := IntToStr(DMP.QueryP03B_.RecordCount)+' Itens Listados';
Tem algum modo de fazer a contagem desses registros?
Eduardo Silva
Curtir tópico
+ 0Post mais votado
24/04/2023
https://docwiki.embarcadero.com/RADStudio/Sydney/en/Fetching_Rows_(FireDAC)#Refetching_Rows
Emerson Nascimento
Gostei + 1
Mais Posts
24/04/2023
Arthur Heinrich
case DMP.QueryP03B_.RecordCount of
0 : frmPrincipal.EplblListagenItens.Caption := '0 Itens Listados';
1 : frmPrincipal.EplblListagenItens.Caption := '1 Item Listado';
else
frmPrincipal.EplblListagenItens.Caption := IntToStr(DMP.QueryP03B_.RecordCount)+' Itens Listados';
end;
Ou pode fazer simplesmente:
if (DMP.QueryP03B_.RecordCount = 1) then frmPrincipal.EplblListagenItens.Caption := '1 Item Listado'; else frmPrincipal.EplblListagenItens.Caption := IntToStr(DMP.QueryP03B_.RecordCount)+' Itens Listados';
Gostei + 1
25/04/2023
Eduardo Silva
https://docwiki.embarcadero.com/RADStudio/Sydney/en/Fetching_Rows_(FireDAC)#Refetching_Rows
Testei aqui e não funcionou 😭
Gostei + 0
25/04/2023
Eduardo Silva
https://docwiki.embarcadero.com/RADStudio/Sydney/en/Fetching_Rows_(FireDAC)#Refetching_Rows
Testei aqui e não funcionou 😭
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)