Developer forum

Forum » Integration » Change product group on import

Change product group on import

Espen Strømsnes
Reply

I was wondering how I can change the product group(s) a product belongs to on import?

Use case:

Import product (PROD1) with group relation (GROUP1) from ERP using the Dynamicweb provider. Data is inserted into EcomProducts and EcomGroupProductRelation.

Then the product PROD1 changes group from GROUP1 to GROUP2 in the ERP system.

When I import the new data a second record is created in EcomGroupProductRelation, which is not what I wanted.

I know that if the import contained all products and all group relations I could check "Remove missing rows after import" to remove any orphaned groups from EcomGroupProductRelation, but the import is delta based (i.e. it only contains a sub-set of all products).


Replies

 
Jonas Krarup Dam
Reply

Hi Espen,

There is no "clean" way of doing this, with a delta import.

The only two ways I can think of are to include all relations and use the "remove missing" as you describe, or to keep track of removed removed relations, and run a second "cleanup" job, using the "delete incomming rows" option.

Alternatively, you'll have to do some custom coding, and handle it in a notification subscriber that runs when the import is finished (or by creating a custom provider).

If you are on 8.7 or later, you can consider using table scripting, and do the extra cleanup in there. Unfortunately, this isn't documented yet, but I'll include a short description of the functionality below.

I will say that this is not the first time I have heard of or seen this problem, and finding a clean solution is on our to-do list, but for now, these are the only solutions I can think of.

/Jonas

 

---------------------------------

Scripting:
We have added a DataIntegrationTableScript class with one overridable method called:
ScriptRow(Dictionary<string, object> input) Dictionary<string, object> Output

and one method called "ScriptingName" which returns a string with the name to show in the gui.
 
 in the GUI we have added a "scripting" icon (same as on columns). this should open a popup, where we can select which scripting class to use for that table. It should only be shown if there exists a class that inherits from the DataIntegrationTableScript class.

If a scripting class is selected for a table mapping in the Data Integration module, the data for each row will be passed through this "ScriptRow" method before being written to the destination.

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

And here's an example of a TableScript remapping a user's ID: http://developer.dynamicweb.com/forum.aspx?PID=48&ThreadID=45186

 

You must be logged in to post in the forum