Skip to main content
Announcements
Announcing Qlik Talend® Cloud and Qlik Answers™ to accelerate AI adoption! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date load constraint

I have a header table and a lines table.

The lines table is linked to the header only on one reference number.

The line table has thousands of records and want to date constrain the load to a smaller period than the total content but there are no fields that would allow me to do this as they are pure transactional information with no reference numbers I can use with a greater than style.

The header table has a date field.

If I load the header table first and join to the latter I only correctly give the header info to the the first line of the lines table.

I want to load the lines table first and then join the header but this means loading all the lines table.

Thanks for any help.

6 Replies
Not applicable
Author

These two tables are 1-1 relation or 1-n or n-n relation ?

Can you please post some sample data how these tables related ?

Not applicable
Author

The table is Header : Lines    1:n

Header

Ref     Date     CustomerCode

Lines

Ref     ItemCode     Qty

Thanks

dominicmander
Partner - Creator
Partner - Creator

Is the reference number that relates the two not a sequential number?

If it is, you could put a condition on that.

Otherwise, if your data source is a SQL database you could easily join the two tables in the database and apply your condition that way.

Anonymous
Not applicable
Author

You could do it in your database extract sql with something like this

select LineTable.blah

from HeaderTable, LineTable

where HeaderTable.Ref = LineTable.Ref

and HeaderTable.Date > YourDate

maxgro
MVP
MVP

Load the header filtering by date in the SQL part

     load

          *;

     SQL select ........... from HeaderTable where HeaderTable.Date > YourDate

Load the lines filtering by date in the SQL part (as Bill suggested, with a sql join between header and lines)

     load

          *;

     SQL select LineTable.blah

from HeaderTable, LineTable

where HeaderTable.Ref = LineTable.Ref

and HeaderTable.Date > YourDate


swuehl
MVP
MVP

If you want to use QV script code (e.g. because you are not querying a DBMS):

Header:

LOAD

Ref,     Date,     CustomerCode

FROM YourHeaderTableSource

WHERE Date > '2015-01-01'; // or whatever threshold you want to use.

Lines:

LOAD

Ref,     ItemCode,     Qty

FROM YourLinesTableSource

WHERE EXISTS(Ref);