Skip to main content
Announcements
Discover what’s possible with embedded analytics! March 6, 10 AM ET SIGN UP!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Adding a flag to each entry in a Table to identify table name

Hi,

I'm loading in data from several tables in Qlik Sense from an ORACLE database, e.g. one table called APPLES and another called ORANGES. What I'm trying to do is create a flag called [ASSET TYPE] that would read "Apples" if coming from the APPLES table and "Oranges" if from the ORANGES table to give me one output.

Any ideas how I might create something like this?

Many thanks,

Sarah

    

ASSET IDASSET TYPEASSET NAMEREGION COUNTRY
X1234ApplesGranny SmithEMEAUK
X0154ApplesPink LadyEMEASpain
X1857OrangesSatsumaLATAMBrazil
X1095OrangesMandarinEMEASpain

LIB CONNECT TO [Oracle_abc.com]

[APPLES]:

LOAD [ASSET ID]

,[ASSET NAME]

,[REGION]

,[COUNTRY]

; SELECT "ASSET ID"

,"ASSET NAME"

,"REGION"

,"COUNTRY"

FROM APPLES;

[ORANGES}:

LOAD [ASSET ID]

,[ASSET NAME]

,[REGION]

,[COUNTRY]

; SELECT "ASSET ID"

,"ASSET NAME"

,"REGION"

,"COUNTRY"

FROM ORANGES;

4 Replies
sunny_talwar

May be like this

[APPLES]:

LOAD [ASSET ID]

,[ASSET NAME]

,[REGION]

,[COUNTRY]

; SELECT "ASSET ID"

,"ASSET NAME"

,"REGION"

,"COUNTRY"

,'Apples' as [ASSET TYPE]

FROM APPLES;

[ORANGES}:

LOAD [ASSET ID]

,[ASSET NAME]

,[REGION]

,[COUNTRY]

; SELECT "ASSET ID"

,"ASSET NAME"

,"REGION"

,"COUNTRY"

,'Oranges' as [ASSET TYPE]

FROM ORANGES;

Anonymous
Not applicable
Author

Hi Sunny,

many thanks for this suggestion - I had tried using a script similar to what you had suggested but was using double quotes instead of your single ones. I replaced this with single quotes in the SELECT part of the statement, e.g.

'Apples' as [ASSET TYPE] but I'm getting the following error message:

The following error occurred:

Connector reply error: ***

Could this be something to do with the fact that I'm trying to connect directly to an Oracle DB?

Many thanks,

Sarah

sunny_talwar

Are you doing Direct Discovery?

Anonymous
Not applicable
Author

Hello Sarah, check the syntax for a missing square-brace that wraps the table name.



Sarah Kebbell wrote:

[ORANGES}:  //<~ missing end square-brace

LOAD [ASSET ID]

,[ASSET NAME]

,[REGION]

,[COUNTRY]

; SELECT "ASSET ID"

,"ASSET NAME"

,"REGION"

,"COUNTRY"

FROM ORANGES;