Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
millan123
Creator II
Creator II

with out date field incremental load with id how can i do?

with out date field incremental load with id how can i do? plz help

1 Solution

Accepted Solutions
kangaroomac
Partner - Creator II
Partner - Creator II

Assuming your id is increasing ascending, you could use something like the following (syntax isn't correct, you'll have to use your own fields and your library reference in the from):

//Load Sales QVD to get the latest Order date

"Sales":

LOAD Order_ID,

     ...

     Product

FROM

Sales.qvd

(qvd);

"Sort_Sales":

NoConcatenate LOAD

*

Resident Sales

ORDER By Order_ID ASC;

DROP Table Sales;

//Using -1 for the Row because it is the last record

//Parameters: Peek(FieldName, Record, Table);

Let vLastID = Num(Peek('Order_ID', -1, 'Sort_Sales'));

DROP Table Sort_Sales;

This will give you the latest Order_ID in the variable vLastID.

Now load the records from your source that are higher than vLastID (your increments).

Concatenate your Sales.qvd with that.

Save the new Table as Sales.qvd.

View solution in original post

9 Replies
ali_hijazi
Partner - Master II
Partner - Master II

save the maximum ID in QVD

then on the next reload get the max ID and select from database where ID>max ID

then save new max ID in QVD

I can walk on water when it freezes
kangaroomac
Partner - Creator II
Partner - Creator II

Assuming your id is increasing ascending, you could use something like the following (syntax isn't correct, you'll have to use your own fields and your library reference in the from):

//Load Sales QVD to get the latest Order date

"Sales":

LOAD Order_ID,

     ...

     Product

FROM

Sales.qvd

(qvd);

"Sort_Sales":

NoConcatenate LOAD

*

Resident Sales

ORDER By Order_ID ASC;

DROP Table Sales;

//Using -1 for the Row because it is the last record

//Parameters: Peek(FieldName, Record, Table);

Let vLastID = Num(Peek('Order_ID', -1, 'Sort_Sales'));

DROP Table Sort_Sales;

This will give you the latest Order_ID in the variable vLastID.

Now load the records from your source that are higher than vLastID (your increments).

Concatenate your Sales.qvd with that.

Save the new Table as Sales.qvd.

millan123
Creator II
Creator II
Author

Thaks, but i need update also

ali_hijazi
Partner - Master II
Partner - Master II

how do you know if a record was updated in your data source?

I can walk on water when it freezes
millan123
Creator II
Creator II
Author

I need to insert And Update with incremental load but there is no date field i have use only ID plzzzzz Help Me

millan123
Creator II
Creator II
Author

I don't know about that but i have to do incremental load

Muthu
Partner - Creator III
Partner - Creator III

kangaroomac
Partner - Creator II
Partner - Creator II

What Ali means is - how do you know the record was updated?

With no "date updated" field how (in pseudo code / English terms) do you know the field has been updated?

If you can't explain that or there is no logic other than the fields gets updated then implementing incremental load is probably not a solution for your problem.

Unless of course you know which ID's were updated (via an Audit table or something similar) in which case you'll:

Load the records from your saved QVD, excluding those ID's.

Add the following:

Load those ID's from source and concatenate them as above to the QVD before saving the new one.

Anonymous
Not applicable

Maybe

QV_Table:

SQL SELECT PrimaryKey, X, Y FROM DB_TABLE

WHERE ModificationTime >= #$(LastExecTime)#;

Concatenate LOAD PrimaryKey, X, Y FROM File.QVD

WHERE NOT Exists(PrimaryKey);

STORE QV_Table INTO File.QVD;