Purpose
The Cascading Lookup control converts matching pairs of single-line-of-text metadata columns in SharePoint into cascading lookup controls when viewed in the MacroView DMF properties dialog.
How it works
As MacroView DMF starts, the information contained in a local configuration file for the control is loaded into memory and as it is about to display a profiling (metadata capture) dialog, MacroView DMF will check whether the metadata columns to be prompted for correspond to one of the Upper-level and Lower-level (Cascading) column pairs defined in the configuration file. If so DMF will display those single-line-of-text columns as lookup columns where the values on column B will be dependent on the selected value in column A.
MacroView DMF will prompt for these columns in a fashion that is different from the way it would normally prompt for a Single Line of Text column:
- The Upper-level column will be prompted for using a Lookup control. The values shown in the lookup will be the unique values of Upper-level Column in the Source List
- The Lower-level column will be prompted for using a Lookup control. The values shown in the lookup will be the Lower-level column values in rows of the Source List where the value of Upper-level Column is that selected for the Upper-level column in the profiling dialog.
- If the user has not selected a value for the Upper-level Column in the Profiling dialog, there will be no values listed for the Lower-level column.
The local configuration file also points to a list in SharePoint containing each columns valid values and dependencies.
Values are listed as retrieved from the SharePoint list – i.e. there is no attempt to page the display in cases where there are a large number of valid values.
There is no type-ahead support or pinned list of previously chosen values for either Upper-level or Lower-level columns.
MacroView DMF respects the Mandatory (required) attribute of both the Upper-level and Lower-level columns.
If the internal column name is specified in the configuration file but not for the selected content type, the column will present as a standard Single Line Text control.
Setting a personal column default
As with standard DMF a user can right-click on this control to set and clear personal default values.
Where a pair of columns is defined as cascading in the configuration file, selecting Set Default on the child column control will also set the default value for the parent column control. Likewise, if Clear Default is selected on the parent column control, the default is also cleared form the child column control.
Note: This control does not offer the option to Clear All Defaults. To clear all personal defaults from other columns, clear them individually or right click on a different column (if one exists) and choose Clear All Defaults.
Client Installation
Run the MSI below to install a DLL that contains the custom field assembly.
MacroView Cascading Lookup control 1.0.2 (for 64 bit Windows)
MacroView Cascading Lookup control 1.0.2 (for 32 bit Windows)
The installation will do the following:
- Install MacroView.DMF.CascadingLookup.dll under C:\Program Files\MacroView\DMF
- Install MacroView.DMF.CascadingLookupProvider.dll under C:\Program Files\MacroView\DMF\Extensions\MacroView\CascadingLookup
- Register the MacroView.DMF.CascadingLookup.dll in the CustomFieldAssemblies value under Computer\HKEY_CURRENT_USER\Software\MacroView\DMF\UserOptions in the registry
- Install an XML file named CascadingLookupConfiguration.xml with the matching column pairs configuration into %appdata%\MacroView DMF\Store\Extensions\SLTCascadingLookup.
Client Configuration
The CascadingLookupConfiguration.xml file located under %appdata%\MacroView DMF\Store\Extensions\SLTCascadingLookup can be edited it to specify additional column pairs and list URLs if required.
The default configuration file looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<cascadinglookup contenttype="IFBDocA">
<parentfield name="DocSource" />
<childfield name="DocCategory" parent="DocSource"/>
<list url="http://spcrimes/sites/c1/SourceCats" name="SourceCats" view="viewDocA">
<parentfield name="scDocSource" />
<childfield name="scDocCategory" parent="scDocSource"/>
</list>
</cascadinglookup>
<cascadinglookup contenttype="IFBDocE">
<parentfield name="DocSource" />
<childfield name="DocCategory" parent="DocSource"/>
<list url="http://spcrimes/sites/c1/SourceCats" name="SourceCats" view="viewDocE">
<parentfield name="scDocSource" />
<childfield name="scDocCategory" parent="scDocSource"/>
</list>
</cascadinglookup>
<cascadinglookup contenttype="IFBDocI">
<parentfield name="DocSource" />
<childfield name="DocCategory" parent="DocSource"/>
<list url="http://spcrimes/sites/c1/SourceCats" name="SourceCats" view="viewDocI">
<parentfield name="scDocSource" />
<childfield name="scDocCategory" parent="scDocSource"/>
</list>
</cascadinglookup>
</configuration>
Each matching pair of columns is defined between <cascadinglookup> tags and includes the following settings:
- contenttype: name of the content type that must be selected for this rule to apply
- parentfield name: name of the parent column
- childfield name and parent: name of the child column and the parent column it is dependent on
- list url: url of the list in SharePoint containing the matching column pair values
- list name: the name of the list
- list view: view to be applied to the list when looking for matching values
- list parentfield name: name of the parent column in the list
- list childfield name and parent: name of the child column and the parent column in the list
List Configuration
The list referenced in the client configuration file must contain a minimum of three columns including a title and parent and child columns matching what has been defined in the CascadingLookupConfiguration.xml file.
The list should also include the views that have been defined in the CascadingLookupConfiguration.xml file to filter the list to show only rows corresponding to each matching column pair.
The below list is an example that matches the configuration file example earlier in this article.
Deploying configuration changes
If you want to deploy changes to the CascadingLookupConfiguration.xml file you can do so by adding a copy of this file to the central configuration location you have defined in MacroView DMF.
Once you have established a central configuration location (in the example below this is the Resources library) you can create the following sub folder structure in that location and save a copy of the CascadingLookupConfiguration.xml file this folder.
MacroView DMF will then automatically replace the local file with this file whenever the DMF local service is restarted.