SPCascadeDropDown Duplicates

Sep 9, 2010 at 5:12 PM

Hi,

I'm having a problem with duplicate entries in the parent drop down list.  I'm modifying the Inventory Tracking site application that came with SP.  I have three lists (field names in parentheses are the Static names):

Categories:

  Title (Title) - text column of types of items, i.e., Mailing Supplies

 

Inventory:

  Title (Title) - text column of name of individual item, ie., Envelope

   Category (AssetType) - Lookup to Title in Categories list

   CategoryLookup (CategoryLookup) - text field set equal to Category

 

Transactions:

  Item (ITItem) - lookup to Title in Inventory

  Category (Category) - lookup to CategoryLookup in Inventory.  SP would not let me create a field that is a lookup to another lookup field.

 

Here is the code I have:

<script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" language="javascript" src="../../../../../Shared%20Documents/jquery.SPServices-0.5.6.min.js"></script>
<script language="javascript" type="text/javascript">
    $(document).ready(function() {
        $().SPServices.SPCascadeDropdowns({
            relationshipList: "Inventory",
            relationshipListParentColumn: "AssetType",
            relationshipListChildColumn: "Title",
            parentColumn: "Category",
            childColumn: "Item",
            debug: true
        });
        $().SPServices.SPCascadeDropdowns({
            relationshipList: "Transactions",
            relationshipListParentColumn: "Category",
            relationshipListChildColumn: "ITItem",
            parentColumn: "Category",
            childColumn: "Item",
            debug: true
        });

    });
</script>

The Transactions list is where all the "sales" are recorded. What I would like is for the user to select a category to filter the items drop-down.  I've tried various permutations of the above but no matter what I do, on the New Sale form, Category always has duplicate entries.  Regardless of which entry I choose, the correct items and the correct number of items show up in the Item drop-down.  I'm sure I'm missing something obvious - at least to those who know what they are doing!  :-)

 

Thanks!

 

Paul

Coordinator
Sep 9, 2010 at 8:00 PM

Paul:

If you're seeing duplicates in the Category column dropdown it's because you have duplicates in your Inventory list. You need the lists to be set up relationally, with only one instance of each value. The parent values should maintain the relationships. You've probably looked at it many times already, but think about in in the Countries/Regions/States example I give in the documentation.

M.

Sep 10, 2010 at 2:03 PM

Marc,

 

My lists are similar to yours in the documentation.  The Category list is like the Countries with one record for each.  The inventory list is like your Regions in that each Category (each Country) can have more than one Inventory Item (Region).  There is indeed just one record for each inventory item in the Inventory list.  The main difference in your example and mine is that I only need two drop-downs (Category to select/filter Items) where you have three.

Paul

Coordinator
Sep 13, 2010 at 9:03 PM

Paul,

Are you seeing all entries in the dropdowns (ie, it's not filtering at all)?

Can you confirm what language your site is in (special characters maybe preventing the filter from working), as well as that you're using the current stable releases of SPServices and jQuery (as opposed to an old or alpha release).

Sep 14, 2010 at 4:08 PM

Hi,

 

Yes, I am seeing all values, no filtering is being done.

 

My site is in english, though there are some "(", "/" and double quotes in the Item names in the Inventory list, there are no special characters in the Category list.  I'm using jquery.SPServices-0.5.6.min and pointing to http://code.jquery.com/jquery-1.4.2.min.js

 

Thanks!

Coordinator
Sep 15, 2010 at 12:43 AM

phbern:

You said:

Transactions:

  Item (ITItem) - lookup to Title in Inventory

  Category (Category) - lookup to CategoryLookup in Inventory.  SP would not let me create a field that is a lookup to another lookup field.

Category there ought to be a lookup to the Title column in Categories. I think that's where the issue is.

M.

Sep 15, 2010 at 5:03 PM

I knew it had to be something obvious!  Thank you, that did the trick!

Coordinator
Sep 16, 2010 at 2:26 AM
Excellent! Glad you solved it. M.