Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
dcvitoria
Contributor
Contributor

How use a function in load * inline?

Hi everyone.

I have a (simple) question: how use a function in load * inline, like this:

LOAD * INLINE [Data, Arquivo, Tipo, Mensagem

     Now(), DocumentName, $(vTipoLog), $(vMensagemLog)];

Or only with variables?

Thanks!

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

The part between square brackets of a LOAD INLINE is an explicit multi-line string. Nothing inside will be handled by he expression evaluator. $-sign substitution will be executed as expected however, as shown in the example by Fer Fer.

But why use an INLINE if you can do it like this?

LOAD Now() AS Data,

     DocumentName() AS Arquivo,

     '$(vTipoLog)' AS Tipo,

     '$(vMensagemLog)' AS Mensagem

AUTOGENERATE 1;

View solution in original post

4 Replies
vishsaggi
Champion III
Champion III

What is that you are getting when you run this Load?

el_aprendiz111
Specialist
Specialist

Hi,

LET vNow                  = Today();
LET vDocumentName         = DocumentName();
LET  vTipoLog              = DocumentPath();
LET vMensagemLog          = 'MyMessage';

LOAD * INLINE
[Data, Arquivo, Tipo, Mensagem
$(vNow), '$(vDocumentName)', '$(vTipoLog)', '$(vMensagemLog)'
]
;

EXIT Script;

Peter_Cammaert
Partner - Champion III
Partner - Champion III

The part between square brackets of a LOAD INLINE is an explicit multi-line string. Nothing inside will be handled by he expression evaluator. $-sign substitution will be executed as expected however, as shown in the example by Fer Fer.

But why use an INLINE if you can do it like this?

LOAD Now() AS Data,

     DocumentName() AS Arquivo,

     '$(vTipoLog)' AS Tipo,

     '$(vMensagemLog)' AS Mensagem

AUTOGENERATE 1;

dcvitoria
Contributor
Contributor
Author

Thank you... the others answers work too, but your working in my format...

SUB gerarLog(vTipoLog, vMensagemLog)

  Teste:

  

  LOAD Now() as Data,

       DocumentName() as Arquivo,

       '$(vTipoLog)' as Tipo,  

       '$(vMensagemLog)' as Mensagem,

       OSUser() AS Usuario,

       ComputerName() as Maquina

  AUTOGENERATE 1;

  

  STORE * FROM Teste  INTO ;

  DROP TABLE Teste;

ENDSUB;