Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 ID | ASSET TYPE | ASSET NAME | REGION | COUNTRY |
X1234 | Apples | Granny Smith | EMEA | UK |
X0154 | Apples | Pink Lady | EMEA | Spain |
X1857 | Oranges | Satsuma | LATAM | Brazil |
X1095 | Oranges | Mandarin | EMEA | Spain |
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;
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;
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:
Could this be something to do with the fact that I'm trying to connect directly to an Oracle DB?
Many thanks,
Sarah
Are you doing Direct Discovery?
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;