Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
[English] Hello, I'm developing a function in Qlik Sense and sometimes Trace() outputs nothing, arbitrarily: sometimes it outputs what I ask, sometimes it doesn't. The code can be found below. More specifically, it happens at the line
"Trace >>> [INICIO] Carga $(nome_tabela) de $(data_i) a $(data_f);", right at the start.
Any ideas on what's going on?
[Português] Olá, estou desenvolvendo uma função no Qlik Sense, e às vezes a função Trace() não imprime nada, arbitrariamente: às vezes imprime, às vezes não. O código pode ser encontrado logo abaixo. Mais especificamente, esse problema acontece na linha
"Trace >>> [INICIO] Carga $(nome_tabela) de $(data_i) a $(data_f);", bem no início da função.
Alguma ideia do que pode estar acontecendo de errado?
SUB CargaPeriodo(funcao, nome_arquivo, data_i, data_f, qtd_meses)
If qtd_meses < 0 Then
Trace ERRO: Argumento qtd_meses deve ser maior ou igual a zero;
Exit Script;
End If;
Trace >>> [INICIO] Carga $(nome_tabela) de $(data_i) a $(data_f);
Let vdDataI = Num(data_i);
Let vdDataCorte = AddMonths(MonthStart(vdDataF), -qtd_meses);
Let vsConsulta = '$(funcao)';
Let vsTabela = '$(nome_arquivo)';
Do while vdDataI <= data_f
Let vdDataF = AddMonths(vdDataI, 1)-1;
Let vsFileName = '$(vsLib)$(vsTabela)_' & Date(vdDataI, 'YYYY_MM') & '.qvd';
Let vbFileExists = if(FileSize('$(vsFileName)') > 0, -1, 0);
If Not vbFileExists Or vdDataCorte <= $(vdDataI) Then
Let vsMensagem = '> ' & Date(vdDataI) & ' a ' & Date(vdDataF) & ': realizando carga...';
Trace $(vsMensagem);
Let vdDataI = Date(vdDataI, 'DDMMYYYY');
Let vdDataF = Date(vdDataF, 'DDMMYYYY');
$(vsTabela):
Load * ;
SELECT * FROM TABLE ($(vsConsulta)(TO_DATE('$(vdDataI)','ddmmyyyy'), TO_DATE('$(vdDataF)','ddmmyyyy')));
STORE $(vsTabela) INTO $(vsFileName) (qvd);
Drop table $(vsTabela);
End If;
Let vdDataI = Num(AddMonths(vdDataI, 1));
Loop ;
Trace >>> [FIM] Carga $(nome_tabela) de $(data_i) a $(data_f);
END SUB
Hi Joao, it executes the sentences inside the Sub but not the trace? or it doesn't enters the sub?
The only reason I see to not show that line is because it doesn't executes the sub or because qtd_meses=0