Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Joining data field in calculation from two tables

Hi,

I am a beginner at using/developing in QV so excuse my rudimentary questions..:)

1.) I would like to use a data field from one table (loaded into script) as a value in another table. The two tables are joined by primary key.

Example:

When trying to use the data field "OrderQty" from table "OrderDetail"  - in - table "Product" (which doesn´t contain a data field form QrderQty) I get an error message.. when loading data.

How do I use the "join" function to be able to calculate new values in the table "Product" with the help of data field "OrderQty"???

BR

Kriss

11 Replies
Not applicable
Author

Hi Swuehl,

thank you very much for this syntax reference!

The code with lookup() works and I am able to calculate the value.

Thanks again.

- Would you mind assisting in one more question on Concatenation?

I am having trouble creating a new table where I can see the datafields from a concatenation of two tables..

I try naming it according to text in "help" text but not sure that I am doing it right.

- should the original tables (Sales) (quota) already be loaded into QV, logical table ?

-- then do I use "select" of fields from (Sales) into "new table" with concatenate of fields from (quota) table...

How do I write this code - to get the new table visible in Script editor.. is it possible?

BR

Kristina

swuehl
MVP
MVP

Kristina,

QV will automatically concatenate a table to another if these two tables having exactely the same amount and named fields.

Tab1:

LOAD

A, B

from Table1.xls;

LOAD

A, B

from Table2.xls;

resulting in one table Tab1.

You can also force concatenation

Tab1:

LOAD

A, B

from Table1.xls;

CONCATENATE (Tab1) LOAD

A

from Table2.xls;

also resulting in one table Tab1, Field B only set with values for records loaded from Table1.xls.

This is mostly it. Instead of loading from Excel files, you can of course reference resident tables.

Hope this helps,

Stefan