Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

bhavvibudagam
Contributor II

how to extract the Table name in to a field

Hi Experts,

Can any one Please help me on this.

From the below script how to pass QLIK from Table name into a New Application Field.

LIB CONNECT TO 'Remedy-ODBC64 (John)';

LOAD

    Client,

    Date,

    START TIME,

    END TIME;

[PROD_QLIK]:

SELECT  Client,

    Date,

    START TIME,

    END TIME

FROM "USER"."PROD_QLIK";


Please help me on how to do this.


Thanks in advance.

1 Solution

Accepted Solutions

Re: how to extract the Table name in to a field

Like this?

:

FOR EACH vTable IN 'PROD_QLIK', 'PROD_TABLEAU', 'PROD_BIGDATA'

  [$(vTable)]:

  NOCONCATENATE

  LOAD SubField('$(vTable)', '_', 2) AS CurrentTableName, *;

  SQL SELECT * FROM "USER"."$(vTable)";

NEXT

:

Don't forget to move your discussion.

View solution in original post

5 Replies
ramasaisaksoft
Valued Contributor III

Re: how to extract the Table name in to a field

Hi Bhavani,

LIB CONNECT TO 'Remedy-ODBC64 (John)';

[Prod]:

LOAD

    Client,

    Date,

    START TIME,

    END TIME;

[PROD_QLIK]:

SELECT  Client,

    Date,

    START TIME,

    END TIME

FROM "USER"."PROD_QLIK";

Here as per the Qlik standards we call [Prod] is the Table name ,so i hope your Database team is created like  "PROD_Qlik " it means Prod table related to Qlik Reporting tool /Table.


If i miss understand your query please correct me.

Re: how to extract the Table name in to a field

There is a script function called TableName() that returns the name of a specific table. Unfortunately, you can't use it to return the name of the table that you are currently LOADing.

As an alternative, and on condition that you can prepare a list of names of tables to extract, you could use a FOR loop to extract and tag them all at once. For example:

:

FOR EACH vTable IN 'PROD_QLIK', 'PROD_TABLEAU', 'PROD_BIGDATA'

  [$(vTable)]:

  NOCONCATENATE

  LOAD '$(vTable)' AS CurrentTableName, *;

  SQL SELECT * FROM "USER"."$(vTable)";

NEXT

:

Best,

Peter

PS Why post a Qlik Sense question in a forum called "New to QlikView"? To move your discussion to New to Qlik Sense, see here: QlikCommunity Tip: How to move your discussion thread

qlik4asif
Contributor II

Re: how to extract the Table name in to a field

Qlik already have a standard system field

$Table


Re: how to extract the Table name in to a field

Like this?

:

FOR EACH vTable IN 'PROD_QLIK', 'PROD_TABLEAU', 'PROD_BIGDATA'

  [$(vTable)]:

  NOCONCATENATE

  LOAD SubField('$(vTable)', '_', 2) AS CurrentTableName, *;

  SQL SELECT * FROM "USER"."$(vTable)";

NEXT

:

Don't forget to move your discussion.

View solution in original post

bhavvibudagam
Contributor II

Re: how to extract the Table name in to a field

Thank you.. Its working..

I have moved to Qliksense.