Developer forum

Forum » Integration » UserProvider: Groups are created multiple times

UserProvider: Groups are created multiple times

Manon Wekking
Reply

Hey!

I am having a problem with the Data Integration, default import functionality. I'm trying to import a CSV with user and group information into DW. I'm using the CSV provider for the source and the User Provider for the destination. The problem I have is that I get multiple groups with the same name, even when I'm using a test CSV where I only have one row. I'm trying to use the name from one column in the CSV as a new user group which I want to add as a child under a default user group. My job looks like the picture in the attachment.

I've bound the CSV to the AccessUserGroup table, I've set the key on the AccessGroupGroupName and then I map the column Account Name to the AccessGroupGroupName. I added a row to map "None" to AccessGroupParentGroupName where I filed in the constant "Companies". The key is irrelevant and is one of the exercises I tried to get it working. The companies will get added under the user group companies, but it gets created multiple times.

DW Version

I'm using DW 8.9.1.6

Context

Our configuration for the users is that every user has some groups they are in, one of which is the company they work for. We create a user group for every company of the users. When I'm importing the users I want to create the companies too, I don't want to create those companies manually. The CSV contains one column for the company name and then all other columns contain user details.

Expected behaviour

I expected the user provider to add only 1 usergroup with the same name when I set the key on the table correctly (in this case AccessGroupGroupName). 

What I have tried so far

I tried some things already of course, which helped me pinpoint the issue. But I haven't found a solution yet.

- I tried setting the key (at number 1 in the picture) to the AccessGroupGroupName, I've also tried to set it to the AccessGroupGroupName and AccessGroupParentGroupName, but nothing seemed to help.

- I've removed an empty row from the csv file

- I've added a row in the CSV file with the same company, the result was that the company was added thrice.

- I've added a column in the CSV called key, which I mapped to AccessGroupExternalID and then set that one as the key

- I've tried setting the destination group (number 3 in the picture) to companies and not setting the AccessGroupParentGroupName, hoping the group would be added there. But it added the group in the root (only one though, so it seems to be connected to the parent)

- I've tried setting the User Key Field to something else, like AccessUserName, but no group keys seem to be available here, so I didn't think that would help much. I've also tried setting it to none, thinking that perhaps it would override the key setting in the table mapping row (at number 1).

Thanks in advance for any help you can offer.

Kind regards,

Manon Wekking

UserproviderImportScreen.png

Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Manon,

I was using the latest 8.9.1.11. I was trying to reproduce your issue with importing just the groups hierarchy and I've used just the default settings which are coming when you create Xml->User provider job which worked fine for me.
So I had a key column: by default "AccessGroupID" and the job mapping and settings shown in the attached image. But it worked fine only for the case when I have "distinct" group names,
and this doesn't work when you have the repeting rows. The problem is that the User provider/and probably all other providers too were not designed to support importing just "distinct" rows (by key columns).

As a work around of this could you try to import just the groups hierarchy from some other csv file and then import users to those groups?

If this is not applicable you could write your own scripting class that is implementing TableScript(Dynamicweb.Data.Integration.TableScript) and inside

public override void ProcessInputRow(Dynamicweb.Data.Integration.Mapping mapping, Dictionary<string, object> row)

you can check what group names were already processed and if found the repeating group name you can set the value for null/empty string in this row:

row["AccessGroupGroupName"] = null;
Compiling and putting the DLL on the solution, will expose it as an available script on Data Integration Jobs: http://screencast.com/t/rk1NhuPq
and then you can select this implemented Script table class in the data integration job mapping on your "AccessGroup" table and add the condition
shown in the attached second image to skip empty groups.

Best regards, Dmitrij

condition.jpg import_groups.jpg
 
Manon Wekking
Reply

Hey Dmitrij,

Thanks for your answer, it's no problem to import the groups apart from the users. I've removed the double names and now only the last on in the file is created twice. Any idea why that might be?

It's not that big of a hassle if he only does that in the real scenario, cause I can just manually delete the double one.

Kind regards,

Manon

 
Manon Wekking
Reply

Sorry the latter post was created twice, because I got an error when I pressed submit, when I refreshed I apparently created the post again (as apparently the error was not that it couldn't create the post, although it sure seemed like it)

 

You must be logged in to post in the forum