Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
eduardo_dimperi
Not applicable

Concatenate variable with Table name

Hi Guys,

Why this not work?

[CFG_CARGA_INTEGRATION]:

LOAD

  RowNo () AS ID,

    CONNECTION,

    CAMINHO,

    EXECUCAO

FROM [lib://MI_csv/CONFIG_INTEGRACAO.xlsx]

(ooxml, embedded labels, table is EXTRACT)

WHERE UPPER(EXECUCAO) = 'S' AND  NOT ISNULL(EXECUCAO);

Let v_Inicio = Num(Peek('ID', -1, 'CFG_CARGA_INTEGRATION'));

for a=1 to v_Inicio

Let vLib = FieldValue('CONNECTION',$(a));

Let vPath = FieldValue('CAMINHO',$(a));

CONCAT_TABLE_$(vPath):

let vCarga=Timestamp(Today(),'YYYYMMDD');

for a=0 to 2

let vCarga=Timestamp(Today()-$(a),'YYYYMMDD');

LOAD

Distinct

*

FROM [lib://MI_csv/Leituras/Individual_Read/RS_INDIVIDUAL_READ_$(vCarga).qvd](qvd) where DATE_READ>TODAY()-2;

next

exit script

Tabela_tmp.JPG

1 Solution

Accepted Solutions
sunny_talwar
Not applicable

Re: Concatenate variable with Table name

Try Square Brakets around the table name:

[CONCAT_TABLE_$(vPath)]:

12 Replies
MK_QSL
Not applicable

Re: Concatenate variable with Table name

May be

let vCarga=Timestamp(Today()-'$(a)','YYYYMMDD');

eduardo_dimperi
Not applicable

Re: Concatenate variable with Table name

Hey Manish

My problem is in the Tables name -> CONCAT_TABLE_$(vPath):


I want to create 2 tables with the same script, for that i put it inside a loop.

But for some reason doesnt work

MK_QSL
Not applicable

Re: Concatenate variable with Table name

What are the contents (fields) for the

CONCAT_TABLE_$(vPath) table?

sunny_talwar
Not applicable

Re: Concatenate variable with Table name

May be like this:

[CFG_CARGA_INTEGRATION]:

LOAD

  RowNo () AS ID,

    CONNECTION,

    CAMINHO,

    EXECUCAO

FROM [lib://MI_csv/CONFIG_INTEGRACAO.xlsx]

(ooxml, embedded labels, table is EXTRACT)

WHERE UPPER(EXECUCAO) = 'S' AND  NOT ISNULL(EXECUCAO);

Let v_Inicio = Num(Peek('ID', -1, 'CFG_CARGA_INTEGRATION'));

for a=1 to v_Inicio

Let vLib = FieldValue('CONNECTION',$(a));

Let vPath = FieldValue('CAMINHO',$(a));

CONCAT_TABLE_$(vPath):

let vCarga=Timestamp(Today(),'YYYYMMDD');

for a=0 to 2

let vCarga=Timestamp(Today()-$(a),'YYYYMMDD');


CONCAT_TABLE_$(vPath):

LOAD

Distinct

*

FROM [lib://MI_csv/Leituras/Individual_Read/RS_INDIVIDUAL_READ_$(vCarga).qvd](qvd) where DATE_READ>TODAY()-2;

next

exit script

eduardo_dimperi
Not applicable

Re: Concatenate variable with Table name

Hi Sunny mi friend,

doesnt work

eduardo_dimperi
Not applicable

Re: Concatenate variable with Table name

Hi Manish,

Sorry, i dont understand. Contents (fields) ?

Did you mean this?:


LOAD

    ID_SYSTEM,

    CONCENTRATOR,

    PORT,

    DATE_READ,

    VALUE_READ,

    COD_ERRO,

    ID_LEITURA

FROM [lib://Ultragaz QVD/RS_INDIVIDUAL_READ_20170224.qvd]

(qvd);



Tabela_tmp.JPG

sunny_talwar
Not applicable

Re: Concatenate variable with Table name

What he is trying to say is that you have a Table name, but where is the LOAD or SELECT underneath?

Capture.PNG

What is the use of declaring a table name and then going to a variable?

eduardo_dimperi
Not applicable

Re: Concatenate variable with Table name

Ahhhh, now i understand.

I paste the code again, in a better vision. But the problem is, if i put only CONCAT_TABLE or CONCAT_TABLE_Ultragaz, it works fine and if i change Ultragaz to a variable  vPath, occur that error messagem

for a=1 to v_Inicio

Let vLib = FieldValue('CONNECTION',$(a));

Let vPath = FieldValue('CAMINHO',$(a));

Let vCarga=Timestamp(Today(),'YYYYMMDD');

for a=0 to 2

let vCarga=Timestamp(Today()-$(a),'YYYYMMDD');

CONCAT_TABLE_$(vPath):

LOAD

Distinct

*

FROM [lib://MI_csv/Leituras/Individual_Read/RS_INDIVIDUAL_READ_$(vCarga).qvd](qvd) where DATE_READ>TODAY()-2;

next

sunny_talwar
Not applicable

Re: Concatenate variable with Table name

Try Square Brakets around the table name:

[CONCAT_TABLE_$(vPath)]: