1,804 articles and 14,766 comments as of Tuesday, April 19th, 2011

EndUserSharePoint has combined resources with NothingButSharePoint.com. You can now find End User (Mark Miller), Developer (Jeremy Thake) and IT Pro SharePoint (Joel Oleson) content all in one place!

This site is a historical archive and is no longer being updated. Please update your favorites, bookmarks and RSS feeds.

NothingButSharePoint.com
Tuesday, July 13, 2010

SharePoint: Extending the DVWP – Part 18: User-Managed Dropdowns – Loading the Relationship list – Part 1

Author: Jim Bob Howard

If you’ve been keeping score, last time we set up a relationship list that will relate two dropdown lists to each other in a parent-child relationship so that we can cascade (or limit) the dropdown selection lists, in the child control, based on a selection in the parent.

There are a couple techniques that I know of to simplify loading the relationship data. We have to be deliberate in how we do this with SharePoint because the Title column is required by default. Last time, I listed our options:

  1. We can make the Title optional (and hide it from view, if desired)
  2. We can make it optional and create a workflow that concatenates the site columns to make up a unique Title. (Not recommended.)
  3. We can us Excel to create our entire Country-State Relationships table and paste the entire thing in here.

I’m going with the first option for this article. I will cover the third in the next article.

At a later date, I might tackle the second option in an article, but I’m reluctant to do so because of the way workflows work that will require lots of error checking and comparisons. The workflow could be very helpful once the initial data is loaded and the entry method is changed to a DVWP or standard one-at-a-time entry. I’ll cover that in a future article.

  1. Make Title optional, by clicking on Settings -> List Settings

  2. Settings -> List Settings

  3. Click on Title under Columns

  4. Click the column name to edit it

  5. Click No  for Require that this column contains information under Additional Column Settings

  6. Set to Optional by setting Required… to ‘No’

  7. Click OK
  8. Click the breadcrumb to return to the datasheet view.
  9. Open another browser tab or window (Window will make it easier to Alt-Tab between the two), and browse to your States (or other ‘child’) list
  10. Select all of the children for one parent (in our case, click on Wyoming; holding the Ctrl and Shift keys on a PC, press the up arrow) and press Ctrl-C to copy the list to the clipboard

  11. Select all of the States that correspond to the USA

  12. Toggle to the relationship list and click on the first cell in the child column

  13. Press Ctrl-V to paste the list into relationship list

  14. Child columns have been pasted in

  15. Click on the first parent cell, click the arrow to reveal the dropdown choices, and choose the parent that corresponds to the children just pasted in

  16. Choose the parent for the first row

  17. Holding the Ctrl and Shift keys, press the down arrow key to highlight all the cells in this column. Still holding Shift, release Ctrl and press the up arrow to deselect the insert row

  18. Select all of the cells in the parent column, except the last one

  19. Press Ctrl-D to ‘fill down’ all of the cells in this column with the value in the first cell

  20. Parent cells filled in

  21. In next cell in the parent column, choose the next parent (Canada, in our case)
  22. Toggle back to the States list. Select the first child for the next parent (Alberta, in our case), and holding Ctrl and Shift, press the down arrow

  23. Canadian Provinces selected

  24. Press Ctrl-C to copy them and toggle back to the relationship list
  25. Move the cursor to the cell in the insert row below the last child entry (Wyoming, in this example), click once, and press Ctrl-V to paste.
  26. Press Ctrl-down arrow to move to the bottom of the list. Press the left arrow to move to the parent column. Holding Ctrl and Shift, press the up arrow. (This will select everything from here to the next cell above that contains data.) Press Ctrl-D to fill down again.
  27. Repeat if you have more parents to enter.

We could have also done this using Excel to get the data the way we wanted it, as well as setting the Title with something descriptive. We’ll cover that option next time we continue Extending the DVWP.

Author: Jim Bob Howard

Jim Bob Howard is a web designer / webmaster in the healthcare industry. He has been working with SharePoint since March 2009 and enjoys sharing what he has learned. He is a moderator and frequent contributor to Stump the Panel, and answers SharePoint questions on Twitter (@jbhoward) and via email ([email protected]).

View all entries in this series: Extending the DVWP»
Entries in this series:
  1. SharePoint: Extending the DVWP - Part 1: Layout Enhancement - Rearranging Columns - Default and Edit Templates
  2. SharePoint: Extending the DVWP - Part 2: Layout Enhancement - Rearranging Columns - Insert Template
  3. SharePoint: Extending the DVWP – Part 3: Getting it All on One Line - DVWP Function Action Links
  4. SharePoint: Extending the DVWP – Part 4: Turning DVWP Action Links into Buttons
  5. SharePoint: Extending the DVWP – Part 5: Doing Stuff Before Save on Submit - PreSaveAction()
  6. SharePoint: Extending the DVWP – Part 6: Examining the Form Action Links
  7. SharePoint: Extending the DVWP – Part 7: Creating a Form Action Workflow
  8. SharePoint: Extending the DVWP – Part 8: Creating a Form Action Workflow - The After Math
  9. SharePoint: Extending the DVWP – Part 9: Oops! Failed Setting Processor Stylesheet
  10. SharePoint: Extending the DVWP – Part 10: Passing Workflow Variables to a Form Action Workflow
  11. SharePoint: Extending the DVWP – Part 11: Getting More Form Fields to the Workflow
  12. SharePoint: Extending the DVWP – Part 12: Adding More Form Fields from the Data
  13. SharePoint: Extending the DVWP – Part 13: Putting PreSaveAction() to Work – Creating Variables
  14. SharePoint: Extending the DVWP – Part 14: Putting PreSaveAction() to Work with jQuery
  15. SharePoint: Extending the DVWP – Part 15: User-Managed Dropdowns with Site Columns
  16. SharePoint: Extending the DVWP – Part 16: User-Managed Dropdowns - Loading Data
  17. SharePoint: Extending the DVWP – Part 17: User-Managed Dropdowns – Creating a Relationship list
  18. SharePoint: Extending the DVWP – Part 18: User-Managed Dropdowns – Loading the Relationship list – Part 1
  19. SharePoint: Extending the DVWP – Part 19: User-Managed Dropdowns – Loading the Relationship list – Part 2
  20. SharePoint: Extending the DVWP – Part 20: Cascading Dropdowns - Applying the jQuery
  21. SharePoint: Extending the DVWP – Part 21: Cascading Dropdowns - Three-tier Cascade
  22. SharePoint: Extending the DVWP – Part 22: Creating Title Based on Other Fields with jQuery
  23. SharePoint: Extending the DVWP – Part 23: Creating Title Based on Other Fields with a Workflow
  24. SharePoint: Extending the DVWP – Part 24: A Note to Readers
  25. SharePoint: Extending the DVWP – Part 25: Using an Audit Trail by Creating List Items with SPServices
  26. SharePoint: Extending the DVWP – Part 26: Modifying the Edit Template
  27. SharePoint: Extending the DVWP – Part 27: Adding an Alternate Edit Template to a DVWP
  28. SharePoint: Extending the DVWP – Part 28: Massage the Remove Template
  29. SharePoint: Extending the DVWP – Part 29: Modifying Form Action Workflows on the remove Template
  30. SharePoint: Extending the DVWP – Part 30: Using EasyTabs with Filtered DVWPs to Make Data Manageable
  31. SharePoint: Extending the DVWP – Part 31: Filling in Default Data on the insert Template with jQuery
  32. SharePoint: Extending the DVWP – Part 32: Filling in Default Data on the insert Template with Multiple DVWPs
  33. SharePoint: Extending the DVWP – Part 33: Modifying Total and Subtotal Row Layouts in DVWP
  34. SharePoint: Extending the DVWP – Part 34: Using Icons for Form Action Links
  35. SharePoint: Extending the DVWP – Part 35: Putting it All Together
  36. SharePoint: Extending the DVWP – Bonus: Fixing the Insert Form Action When "No Matching Items"
  37. SharePoint: Extending the DVWP – Bonus: Creating a Title Based on Dropdowns with jQuery
 

Please Join the Discussion

2 Responses to “SharePoint: Extending the DVWP – Part 18: User-Managed Dropdowns – Loading the Relationship list – Part 1”

Trackbacks

Check out what others are saying about this post...
  1. SharePoint Kaffeetasse 193…

    SharePoint Designer 2010 Extending the DVWP – Part 17: User-Managed Dropdowns – Creating a Relationship…

  2. [...] some site columns, load them with data, and create relationship lists between the site columns (and load those one of two ways). Then we’ll put those site columns and relationships to work with cascading [...]




Notify me of comments to this article:


Speak and you will be heard.

We check comments hourly.
If you want a pic to show with your comment, go get a gravatar!