Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
francofiorillo
Contributor

know the name of the db

know the name of the db
hello

I would like to kindly help.

I need to load and concatenate together the same table, we call to exemplify INVOICES, several data base.

for the individual lines of coming conoscerela INVOICES I thought of adding a field in the table the name of the DB.

I do not know if you know the name of the DB and how do you add in an additional field in the load the contents of this possible variable containing the name of the DB.

Thank you in advance for any feedback

1 Solution

Accepted Solutions
MVP
MVP

Re: know the name of the db

Maybe this?

[Invoices]:
LOAD *
,'Database1' as Database
;
SQL SELECT
Invoice
,Amount
FROM Database1
;
CONCATENATE ([Invoices])
LOAD *
,'Database2' as Database
;
SQL SELECT
Invoice
,Amount
FROM Database2
;

Or maybe this if you're loading exactly the same fields from each database:

FOR EACH vDatabase IN 'Database1','Database2'
    [Invoices]:
    LOAD *
    ,$(vDatabase) as Database
    ;
    SQL SELECT
     Invoice
    ,Amount
    FROM $(vDatabase)
    ;
NEXT

2 Replies
MVP
MVP

Re: know the name of the db

Maybe this?

[Invoices]:
LOAD *
,'Database1' as Database
;
SQL SELECT
Invoice
,Amount
FROM Database1
;
CONCATENATE ([Invoices])
LOAD *
,'Database2' as Database
;
SQL SELECT
Invoice
,Amount
FROM Database2
;

Or maybe this if you're loading exactly the same fields from each database:

FOR EACH vDatabase IN 'Database1','Database2'
    [Invoices]:
    LOAD *
    ,$(vDatabase) as Database
    ;
    SQL SELECT
     Invoice
    ,Amount
    FROM $(vDatabase)
    ;
NEXT

francofiorillo
Contributor

Re: know the name of the db

perfect. was what I wanted. it works. thank you very much.

Community Browser