This project has moved and is read-only. For the latest updates, please go here.

Modify SPCascadeDropdowns

Dec 9, 2009 at 5:08 PM

Hi All,

   First let me say thank you for this great library! The reason I'm writing is because I need to change the SPCascadeDropdowns function, in order to comply with the following:

Instead of having one parent dropdown to modify the values of a child dropdown, I want to be able to just put a numeral value in a field, whenever a parent dropdown value is select.

The steps to do this would be:

1. I select a value in the parent dropdown.
2. A numeral value is populated in the child number field automatically.

Let's say I have a contribution type, which has a value in points associated. so the way this should work is that when I select a contribution (a technical paper, tip, etc) the value in points for that contribution should come up automatically, and be placed in the field.

Why do I need this?, because I need to be able to do a SUM() on the points value in the contribution list view, and that can only be accomplished if the field its of type numeric. Which is not the case if I use 2 dropdown boxed (lookup)

 So, I have been having trouble identifying/isolating the SPCascadeDropdowns  function itself to start replicating/modifying it.

Any help would be greatly appreciated, and offcourse the produced code would be available to the community afterwards.

Kind regards,


Dec 9, 2009 at 7:34 PM


A couple of thoughts, if I understand your requirements:

  • You could store the contribution types in a list, along with the point value.  In your "host" list, you can have a Lookup column into the contribution type value.
  • In your form, your user would just select the contribution type as it sounds like they are now.
  • For your view where you want to sum the points, use a Data View Web Part (DVWP) rather than the standard List View Web Part (LVWP).  With the DVWP, you can have an AggregateDataSource, and grab the point value when the DVWP is rendered.  This is a better long term solution, as it adheres to relational databases rules.  If you needed to change the point values, then all would just flow through.

Make sense?


Dec 10, 2009 at 2:53 PM

Hi Marc,

   Thanks for the quick reply. I will try what you mention above, but I don't think I will achieve the exact behavior that I'm looking for.

I want the list view to look like this:

As you can see the points filed is part of the list itself, that's what I want to be populated, based on the contribution type selected when adding the item to the list.

Do you still think this can be done using the DVWP?

Kind regards,


Dec 10, 2009 at 3:17 PM

What I'm saying is that it would be better if the point value was *not* a part of this list. If you have a separate list (let's call it Contribution Types) as below, you can use the DVWP to grab the point value which corresponds to the Contribution Type and sum it up.  If you ever wanted to change the point values the way you are doing it, you'd need to go and change all of the items in your list.  If you go with my approch, you just change it once in the Contribution Types list and you are done.

Contribution Type Points
Brown Bag Session 5
Community Post 7


Dec 10, 2009 at 3:25 PM

Hi Marc, I understand what you are saying, the above it's just a sample of what things should look like. Actually I'm not looking forward to using that extra field.

But it was the only "easy/cheaper way" to doit, and since I don't care for the points to be updated for the ones given, that's ok.

Do you think that's possible to do just by using the DVWP? If you think so I'll point my guns into that direction :)



Dec 10, 2009 at 3:32 PM

I think I would go the DVWP route, but I'm very familiar with them.  There are definitely multiple ways to go with this, and you should choose what is going to work best based on your requirements, skills, etc.  At least for the time being, none of my functions are going to get you all the way there.


Dec 10, 2009 at 7:11 PM

Ok, I was able to make this work using a DVWP, but unfortunately there's no way of have the total value (sum) of a joined subview value for a given group, like here:

I cannot make total points to calculate the total contribution points.

Well thanks again for all your help, I guess I'll find this sooner or later.




Dec 10, 2009 at 7:25 PM

Sure you can.  You just may not be able to do it through the dialogs.  If you can think of it, you can do it with a DVWP.  What you'll want to do is add a sum into the code for the groupings.  It's actually pretty straightforward if you know how.  Did you go with the separate list like we went over above?


Dec 10, 2009 at 8:06 PM

Perhaps the above picture wasn't a good example, let me show you what's really underneath:

So really the question is how can I sum() the contributionpoints that are within a group.

Really thanks for your help! I couldn't have done this without your help.




Dec 10, 2009 at 8:23 PM

You can add the formula to the group footer.  It will look something like this:

<xsl:value-of select="sum(/dsQueryResponse/second_list/Rows/Row[@Contribution_x0020_Type = current()/@Contribution_x0020_Type]/@ContributionPoints)"/>

Without knowing exactly how you have things set up, this won't be right, but you should get the idea.


Dec 10, 2009 at 9:36 PM

Hi Marc,

   Using this, because @Title and @Contribution_x0020_Type are the keys:


<xsl:value-of select="sum(/dsQueryResponse/ContributionTypes/Rows/Row[@Title=current()/@Contribution_x0020_Type]/@ContributionPoints)"/>

I get as a result in the "Advanced Condition" editor in SPD these values:

10; 10; 10; 10;

That's because if you add the totals for the group you'll get 10, and it's repeated 4 times because I have 4 entries.

The problem is that when I insert that in the actual page, I get as a result 4, which is the last value of the points, not the overall adding. I'll continue fiddling with these values and see what happens

Thanks again !!!