Data import - need to re-import

Posted By saturation Wed 14 Sep 2011
Add to Favorites1
Author Message
saturation
 Posted Wed 14 Sep 2011
Supreme Being

Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)

Group: Forum Members
Last Active: Fri 30 Nov 2012
Posts: 108, Visits: 1,185
I know there are 3 options when importing.   I need to basically reimport all products but still keep the same codenumber because I want my existing customers to still have the products correctly tied to their saved baskets and/or orders.  

If I choose to overwrite all existing data with the import but keep the correct V_Codenumber in the spreadsheet, will Kartris preserve the products and versions as they currently exist in my DB or will it create completely new ones?
Medz
 Posted Thu 15 Sep 2011
Kartris Expert

Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)

Group: Administrators
Last Active: Tue 3 Dec 2013
Posts: 99, Visits: 1,400
Only the 1st option (clear all product data first then import data) deletes existing product/version data in the database.

Choosing the 1st or the 2nd option always preserve products and versions data. The only difference between the two is the 1st option doesn't touch the existing data at all. It just finds new products in the spreadsheet and tries to add them all to the database. The 2nd option reads all the V_CodeNumber in the spreadsheet and either update the matching version records in the database or create new product/version records if they don't exist yet.

option 1 - delete all data in db then import spreadsheet

option 2 - don't touch existing product/version data in db, just import new ones

option 3 - update existing product/version data in db by matching V_Codenumber, also import new ones
Sat 17 Sep 2011 by Medz
saturation
 Posted Fri 16 Sep 2011
Supreme Being

Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)Supreme Being - (64,854 reputation)

Group: Forum Members
Last Active: Fri 30 Nov 2012
Posts: 108, Visits: 1,185
So basically,

a) the carts/products/versions are tied to IDs that are stored in the databases, not "v_codenumber"?

b) "clear all product data first then import data" will actually physically delete the products from the database, and all new products/versions that are added get new record IDs?

It sounds like I only want to use the "Clear all products, etc...." if I am in a test/development environment so I don't destroy the data relationship between the actual products and the products in my customer's saved baskets?
Medz
 Posted Sat 17 Sep 2011
Kartris Expert

Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)Kartris Expert - (65,924 reputation)

Group: Administrators
Last Active: Tue 3 Dec 2013
Posts: 99, Visits: 1,400
Unfortunately choosing option 1 (clear all product data then import data) will delete existing records so there's a big chance that the imported product/versions records will get different IDs. Its still possible to get the same IDs with this option though if you just edit and add new data at the end of the same spreadsheet you used when you did your first data tool import.

Also, importing from spreadsheet/csv files shouldn't affect existing order/invoicerows records as they're saved separately. The invoicerows table stores the V_Codenumber, V_Name, V_Price and V_tax values for the orders. For the saved baskets, the items are linked via V_ID field so they are the only the ones that will be affected. Can you let me know how many records do you have in tblKartrisSavedBaskets? If its only a handful I think it should be possible to run a query to replace the old item IDs with the new ones. The saved basket items records are actually stored in 'tblKartrisBasketValues' table so it should be possible to list them out using this query ->

SELECT DISTINCT tblKartrisBasketValues.BV_VersionID, tblKartrisVersions.V_CodeNumber FROM 
tblKartrisBasketValues LEFT OUTER JOIN tblKartrisVersions ON tblKartrisBasketValues.BV_VersionID =
tblKartrisVersions.V_ID WHERE (tblKartrisBasketValues.BV_ParentType = 's')



After the import you can then issue another query to update the records one by one->


UPDATE[tblKartrisBasketValues] SET [BV_VersionID] = PUTOLDIDHERE WHERE [BV_VersionID] = PUTNEWIDHERE

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top