SPCascadeDropdowns: Duplicate Values in Child Column

May 6, 2010 at 2:04 PM

From yeahnahyeah:

Marc, I am wondering about possible bug here. I hope I can explain it. I too have been having a problem with duplicate values in child list and the above post gave me a hint as to what might be wrong. In my case the child list has a SharePoint column/field in it that uses a "multi-select" dropdown list, now this column is not being used for the cascade itself (the title column is being used in my case). Every time I add another item from the multi-select and save the list item, it adds a duplicate record of that list item's title to the child drop down list, despite there only being one record. If I edit the list item and remove the multi-select items and save the duplicates disappear. I have just updated my script to the 0.5.4 version and still have the same problem.

May 6, 2010 at 2:06 PM

Can you post the code for the SPCascadeDropdowns call? Also, can you show the details of the relationshipList? I'll try to recreate this in my test environment so that we can figure it out.


May 6, 2010 at 2:44 PM
Edited May 6, 2010 at 3:30 PM

Thanks for looking at this Marc. Just for the record it also appears to occur (for me at least) when then there is a column/field in the child list that uses a "People or Groups" field that allows multiple values and more than one value is added. The quickest way possibly for you to test my problem is to use your Regions/States example, add another column to the "States" list, make it a drop down list and allow "multi-select", then edit a state record and add multiple values to that new column, no need to change your scripts. See whether you then get duplicate states show up in your drop down. If you don't then clearly I have done something wrong in my implementation.

I have three lists:

-> Groupings
-> -> Services

My code is:

relationshipList: "Groupings", //name of my list
relationshipListParentColumn: "Theme",
relationshipListChildColumn: "Title",
parentColumn: "Theme",
childColumn: "Grouping",
promptText: "Select {0}...",
debug: false

relationshipList: "Services", //name of my list
relationshipListParentColumn: "Grouping",
relationshipListChildColumn: "Title",
parentColumn: "Grouping",
childColumn: "Service",
promptText: "Select {0}...",
debug: true

In my "Services" list, I have another column/field called "User" which is a Drop Down list column type that allows multi-select. If I add one item from the user drop down list, no problem, if i add more than one item and save then I start getting duplicates in the Services drop down list.

May 6, 2010 at 3:21 PM

Ok, I added a multiselect to my States list and selected all three values for Massachusetts.  Then when I look at my test page and set the Region to Northeast, I only see Massachusetts once. I think that's what you were suggesting, right? FYI - In my test, the States list has more than 20 values.

In your Groupings and Services lists, are there any duplicate values in the Title columns (within each list)? Usually I use SPRequireUnique on the relationshipLists to avoid that.


May 6, 2010 at 4:37 PM

Ok, I have misinformed you slightly! My fault should have checked my lists more closely. The fields causing the problem are not  "drop down lists" but rather are "lookup" with "multi-select" equal to true. So the lookup column can be a list "lookup" or a "People and Groups" lookup. I set up another test using your Country/Region/State example on my test server. To the State list I then added a column and called it "Staff", I made it a "People and Groups" lookup column type, allowed multi-select and set the "Show field" option to "Name" (not name with Presence).  I then edited a state record, added multiple staff to the new "Staff" column. So the resulting list item data was something like:

State = Alabama
Region = Southeast
Country = United States
Staff = Bloggs, J; Smith, J; Brown, S

I then checked the States drop down list and it had "Alabama" listed twice.

May 6, 2010 at 5:49 PM
Edited May 6, 2010 at 5:52 PM

No worries. Sometimes half the battle (or more) is figuring out the problem, as opposed to figuring out the solution!

Let me just check on this.  So your Staff column is a 'Lookup (information already on this site)' column which allows multiple selections?  And

Get information from:
-> A list in this site
In this column:

 -> A column which is a Person or Group column

Wait.  That can't be right because Lookup columns can't lookup into Person or Group columns.  Sorry, I'm still not there yet.


May 6, 2010 at 7:47 PM
Edited May 6, 2010 at 7:50 PM

In my test example, I used a "People and Groups" column with multi-select set to true, so I am adding people from our local network. If I add one person, no problems everything works. If I add another person, I get a duplicate "state" in the drop down (in my example above it was "Alabama" that appeared twice). If I add a third person I get 3 "Alabama" options appear and it goes on incrementing the more people I add.

So in the test I have 4 lists:

- Country
- >Region
- >->State (with an addition column called "Staff" which is a "People and Groups" column with multiselect = true and "Show field" set to "Name".) This column has no relevance to States but I just put it there to test the problem I am having.

->->-> State Descripton

The list called "State Descripton" is where I have used the Cascading Menu script, using the three drop down menus, "Country", "Region", "State" to get the "State" value. Again this list is just to test the problem.

On the site where I originally had this issue, I was not using a "People and Groups" column but rather a "lookup" column, looking up a "Title" on another list (not any of the cascading list menu lists by the way).

I hope that clarifies.

May 6, 2010 at 8:05 PM

I'm really trying to reproduce this, but I'm still not seeing it.

I've got the same three lists: "Country", "Region", and "State". I've added a new column called Staff to the State list and made it a People or Groups column, allowing multiple selections.  I've added two or more people to the Staff column for Massachusetts, and then on my EditFormCustom for my 'Sales Oppurtunities' list, I select Region=Northeast and I still see only one Massachusetts.

I've also tried adding another column to States called 'Main Cities' which is a lookup column to my Cities list, allowing multiple selections. I've added 5 or more cities to that column, and I only see one Massachusetts.

Let's take a step back.  Are you running on MOSS or WSS? What Service Pack, etc.?  (My test environment is running WSS with SP2.)

Sorry if I'm being dense about this.


May 7, 2010 at 1:39 PM
Edited May 7, 2010 at 3:00 PM

Hi Marc, sorry for not getting back sooner. I am in UK.

Ok I am using MOSS 2007 with SP1.

However, I think I may have worked it out. After getting your feedback I did a few more tests using my Countries/Regions/States example. I removed my "Person and Group" column from the "States" list and then added another "Person and Group" column (with mult-select = true). I edited a state record and added a few people. The problem dissappeared and I thought ... am I going crazy! Then I deleted that column and added a list "Lookup" column using the "Countries" list as the lookup list. I edited a state record and added a few countries. No problem again. Then I edited the "Lookup" and made it a mandatory field, went back and checked the drop down list and bingo ... duplicate values. So then I deleted the lookup column from the "States" list and added another "Person and Group" column, this time I made it mandatory. I edited another state record, added a few people. I went back to the drop down lists and again duplicates. It seems to be related to mandatory, multiselect = true, Person and Groups or Lookup columns???

Any help appreciated. In the the mean time I can fix the problem I was having by unchecking the mandatory option.


May 7, 2010 at 3:06 PM

AHA! Ok, that's got it.  I can see the issue now in my environment.  That gives me something to work from.  Sorry it took us a while to get me there, but that's half the battle!

I'll take a look at what's going on and update tyou when I have insights. Hopefully this fix is relatively straightforward and I can get it into the next release. I appreciate your willingness to work with me on this.


May 7, 2010 at 3:08 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.