Developer forum

Forum » Integration » Having problem with EcomStockUnit import

Having problem with EcomStockUnit import

Tan Pang Lin Dynamicweb Employee
Tan Pang Lin
Reply

Hi 

We are going to embark on integration project that required UOM variants.   

We had tired to import (insert) EcomStockUnit and not able to get a success import,   the error message is below

2018-09-28 11:10:25.299 Starting job - x stock unit.  
2018-09-28 11:10:26.095 Starting import to temporary table for EcomStockUnit.  
2018-09-28 11:10:26.174 Added 1 rows to temporary table for EcomStockUnit.  
2018-09-28 11:10:26.174 Finished import to temporary table for EcomStockUnit.  
2018-09-28 11:10:26.174 Starting update products information.  
2018-09-28 11:10:26.174 Update products information completed.  
2018-09-28 11:10:26.205 Job Failed with the following message: failed to move data from temporary table [dbo.EcomStockUnitTempTableForBulkImport1] to main table [dbo.EcomStockUnit]. Exception: Length cannot be less than zero. Parameter name: length Sql query: if exists (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID('[EcomGroupRelationsIndexesTempTable]')) drop table [EcomGroupRelationsIndexesTempTable];  
2018-09-28 11:10:26.392 Finished job - x stock unit.  
2018-09-28 11:10:26.392 Batch failed

we tried it on Rapido demo system.  http://shop.40dage.com/, attached is the file for your reference.

Please advise where else did I gone wrong.

Thanks

Pang Lin

 

 


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Tan,
it looks like you are using wrong PK set which is misssed in the mappings:

Try to change the non-existing "Id" to "StockUnitId".
Regards, Dmitrij

 
Tan Pang Lin Dynamicweb Employee
Tan Pang Lin
Reply

Dear Dmitrij

Thanks you for the response.

I had changed as per attached image,  and get the below error

Please advise 

BTW,  what is PK?  how to make sure that I have right PK?

Thanks

Pang Lin

 

 

 

 

TIME
MESSAGE
 
2018-10-01 19:05:43.199 Batch failed.  
2018-10-01 19:05:43.199 Finished job - a 4 stock unit.  
2018-10-01 19:05:43.058 Job Failed with the following message: Cannot parse 'EA' to System.Int. Table: EcomStockUnit. Column: Id The failed input row is: [StockUnitProductId:"P000113"], [StockUnitQuantity:"99999"], [StockUnitId:"EA"]  
2018-10-01 19:05:43.058 Starting import to temporary table for EcomStockUnit.  
2018-10-01 19:05:41.558 Finish checking input files changing  
2018-10-01 19:05:36.536 Start checking input files changing  
2018-10-01 19:05:36.489 Starting job - a 4 stock unit.

 

stockunitscreenshot.png
 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Tan,
the error is obvious, StockUnitId must an integer value to be imported into Dynamicweb.
PK is a primary key, read more here
Regards, Dmitrij

 
Tan Pang Lin Dynamicweb Employee
Tan Pang Lin
Reply

Dear Dmitriy

Thanks your for your response. 

Please find attached excel file exported from DW after perform the setup manually from the backend.    the excel file showed that the StockUnitID need not be integer.  Also,  it cannot be integer becuase the value will eventually coming from D365.   Having it as running number will require additonal custom table to allow customer to manually map the integer key to key of UOM in D365.

If you are referring to ID,  then my query is "I have understanding that in order to insert a record to DW's table,  I had to leave the ID (which is key ) out.  This is becuase DW will auto generate the key (which is running number) after the job had completed.

I am not sure are your trying to tell me that for this EcommStockUnit table,  we cannot leave the ID out when performing insert action.  If that is the case,  may I know where can I get the last key number for the field ID of EcommStockUnit table.

Attached image file are the data that will be coming from D365 and how we plan to get the data from D365.

thanks

Pang Lin

 

 

 

 

stockunitID_cannot_be_number.png
 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Tan,
sorry I was wrong about "StockUnitId must be an integer value to be imported into Dynamicweb". Correct is "Id" must be an integer value to be imported into Dynamicweb. But if you do not have "Id" in the source then you can just use StockUnitId column but make it as a key column and do not include "Id" in the column mappings

 


That should generate Id automatically.
Here are my setings that imported your sample xslx file fine to mine 9.5 Dynamicweb:

StockUnitVariantId is a scripting (yelow row wih a right pencil icon) as database column StockUnitVariantId doesn't allow nulls so empty string is supplied there:


Key column:



Regards, Dmitrij

Votes for this answer: 2
 
Tan Pang Lin Dynamicweb Employee
Tan Pang Lin
Reply

Thank you Dmitrij

It worked now. 

 

You must be logged in to post in the forum