Como montar essa consulta?
procedure TFrmRelRequerMatricula_ModII_2.BtnImprimeClick(Sender: TObject);
var
i, j : integer;
aux, mensagem : string;
DEF_AUDITIVA, DEF_MULTIPLA, DEF_MENTAL, DEF_FISICA, DEF_VISUAL, CONDUTAS_TIPICAS, SINDROME, SUPERDOTADO : string;
begin
ppDoencas.Caption := '';
i := 0;
if IBQryAlunoDEF_AUDITIVA.Value = 'True' then
begin
DEF_AUDITIVA := 'Deficiência Auditiva';
i := i + 1;
end
else
DEF_AUDITIVA := '';
if IBQryAlunoDEF_MULTIPLA.Value = 'True' then
begin
DEF_MULTIPLA := 'Deficiência Múltipla';
i := i + 1;
end
else
DEF_MULTIPLA := '';
if IBQryAlunoDEF_MENTAL.Value = 'True' then
begin
DEF_MENTAL := 'Deficiência Mental';
i := i + 1;
end
else
DEF_MENTAL := '';
if IBQryAlunoDEF_FISICA.Value = 'True' then
begin
DEF_FISICA := 'Deficiência Física';
i := i + 1;
end
else
DEF_FISICA := '';
if IBQryAlunoDEF_VISUAL.Value = 'True' then
begin
DEF_VISUAL := 'Deficiência Visual';
i := i + 1;
end
else
DEF_VISUAL := '';
if IBQryAlunoCONDUTAS_TIPICAS.Value = 'True' then
begin
CONDUTAS_TIPICAS := 'Condutas Típicas';
i := i + 1;
end
else
CONDUTAS_TIPICAS := '';
if IBQryAlunoSINDROME.Value = 'True' then
begin
SINDROME := 'Sindrome';
i := i + 1;
end
else
SINDROME := '';
if IBQryAlunoSUPERDOTADO.Value = 'True' then
begin
SUPERDOTADO := 'Superdotado';
i := i + 1;
end
else
SUPERDOTADO := '';
case i of
1 : aux := '';
2 : aux := ' e ';
else
aux := ', ';
end;
for j := 1 to i do begin
if (j = i-1) and (i > 2) then
aux := ' e ';
mensagem := DEF_AUDITIVA+aux + DEF_MULTIPLA+aux + DEF_MENTAL+aux + DEF_FISICA+aux + DEF_VISUAL+aux +
CONDUTAS_TIPICAS+aux + SINDROME+aux + SUPERDOTADO;
end;
if i = 1 then
begin
ppDoencas.Caption := mensagem;
end
else
ppDoencas.Caption := copy(mensagem,1,(length(mensagem)-2));
ppReport1.Print;
close;
end;
var
i, j : integer;
aux, mensagem : string;
DEF_AUDITIVA, DEF_MULTIPLA, DEF_MENTAL, DEF_FISICA, DEF_VISUAL, CONDUTAS_TIPICAS, SINDROME, SUPERDOTADO : string;
begin
ppDoencas.Caption := '';
i := 0;
if IBQryAlunoDEF_AUDITIVA.Value = 'True' then
begin
DEF_AUDITIVA := 'Deficiência Auditiva';
i := i + 1;
end
else
DEF_AUDITIVA := '';
if IBQryAlunoDEF_MULTIPLA.Value = 'True' then
begin
DEF_MULTIPLA := 'Deficiência Múltipla';
i := i + 1;
end
else
DEF_MULTIPLA := '';
if IBQryAlunoDEF_MENTAL.Value = 'True' then
begin
DEF_MENTAL := 'Deficiência Mental';
i := i + 1;
end
else
DEF_MENTAL := '';
if IBQryAlunoDEF_FISICA.Value = 'True' then
begin
DEF_FISICA := 'Deficiência Física';
i := i + 1;
end
else
DEF_FISICA := '';
if IBQryAlunoDEF_VISUAL.Value = 'True' then
begin
DEF_VISUAL := 'Deficiência Visual';
i := i + 1;
end
else
DEF_VISUAL := '';
if IBQryAlunoCONDUTAS_TIPICAS.Value = 'True' then
begin
CONDUTAS_TIPICAS := 'Condutas Típicas';
i := i + 1;
end
else
CONDUTAS_TIPICAS := '';
if IBQryAlunoSINDROME.Value = 'True' then
begin
SINDROME := 'Sindrome';
i := i + 1;
end
else
SINDROME := '';
if IBQryAlunoSUPERDOTADO.Value = 'True' then
begin
SUPERDOTADO := 'Superdotado';
i := i + 1;
end
else
SUPERDOTADO := '';
case i of
1 : aux := '';
2 : aux := ' e ';
else
aux := ', ';
end;
for j := 1 to i do begin
if (j = i-1) and (i > 2) then
aux := ' e ';
mensagem := DEF_AUDITIVA+aux + DEF_MULTIPLA+aux + DEF_MENTAL+aux + DEF_FISICA+aux + DEF_VISUAL+aux +
CONDUTAS_TIPICAS+aux + SINDROME+aux + SUPERDOTADO;
end;
if i = 1 then
begin
ppDoencas.Caption := mensagem;
end
else
ppDoencas.Caption := copy(mensagem,1,(length(mensagem)-2));
ppReport1.Print;
close;
end;
Osmar
Curtidas 0
Respostas
Emerson Nascimento
01/03/2020
Desculpe, mas não entendi. Que consulta?
GOSTEI 0
Osmar
01/03/2020
Boa tarde amigo já resolvi ficou assim:
procedure TFrmRelRequerMatricula_ModII_2.BtnImprimeClick(Sender: TObject);
var
aux: string;
procedure Concatenar(Texto: string);
begin
ppDoencas.Caption := Texto + aux + ppDoencas.Caption;
if aux = '' then
aux := ' e '
else
if aux = ' e ' then
aux := ', ';
end;
begin
ppDoencas.Caption := '';
aux := '';
if IBQryAlunoSUPERDOTADO.AsBoolean then
Concatenar('Superdotado');
if IBQryAlunoSINDROME.AsBoolean then
Concatenar('Sindrome');
if IBQryAlunoCONDUTAS_TIPICAS.AsBoolean then
Concatenar('Condutas Típicas');
if IBQryAlunoDEF_VISUAL.AsBoolean then
Concatenar('Deficiência Visual');
if IBQryAlunoDEF_FISICA.AsBoolean then
Concatenar('Deficiência Física');
if IBQryAlunoDEF_MENTAL.AsBoolean then
Concatenar('Deficiência Mental');
if IBQryAlunoDEF_MULTIPLA.AsBoolean then
Concatenar('Deficiência Múltipla');
if IBQryAlunoDEF_AUDITIVA.AsBoolean then
Concatenar('Deficiência Auditiva');
var
aux: string;
procedure Concatenar(Texto: string);
begin
ppDoencas.Caption := Texto + aux + ppDoencas.Caption;
if aux = '' then
aux := ' e '
else
if aux = ' e ' then
aux := ', ';
end;
begin
ppDoencas.Caption := '';
aux := '';
if IBQryAlunoSUPERDOTADO.AsBoolean then
Concatenar('Superdotado');
if IBQryAlunoSINDROME.AsBoolean then
Concatenar('Sindrome');
if IBQryAlunoCONDUTAS_TIPICAS.AsBoolean then
Concatenar('Condutas Típicas');
if IBQryAlunoDEF_VISUAL.AsBoolean then
Concatenar('Deficiência Visual');
if IBQryAlunoDEF_FISICA.AsBoolean then
Concatenar('Deficiência Física');
if IBQryAlunoDEF_MENTAL.AsBoolean then
Concatenar('Deficiência Mental');
if IBQryAlunoDEF_MULTIPLA.AsBoolean then
Concatenar('Deficiência Múltipla');
if IBQryAlunoDEF_AUDITIVA.AsBoolean then
Concatenar('Deficiência Auditiva');
GOSTEI 0