Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bhavvibudagam
Creator II
Creator 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
Peter_Cammaert
Partner - Champion III
Partner - Champion III

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

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.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

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
Creator III
Creator III

Qlik already have a standard system field

$Table


Peter_Cammaert
Partner - Champion III
Partner - Champion III

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.

bhavvibudagam
Creator II
Creator II
Author

Thank you.. Its working..

I have moved to Qliksense.