Skip to content

Listing choices in RCDC Dropdowns

To add a dropdown to a FIM Portal RCDC you can use the UocDropDownList control. This post shows you three (and a half) different ways to populate the choices.

1. Hard-coded in the control

Hard-coding is best for when you have a small number of possibilities that are unlikely to change, such as in this example from the standard Group Edit RCDC:

<my:Control my:Name="Scope" my:TypeName="UocDropDownList" my:Caption="{Binding Source=schema, Path=Scope.DisplayName}" my:RightsLevel="{Binding Source=rights, Path=Scope}">
	<my:Options>
		<my:Option my:Value="DomainLocal" my:Caption="%SYMBOL_DomainLocalCaption_END%" my:Hint="%SYMBOL_DomainLocalHint_END%"/>
		<my:Option my:Value="Global" my:Caption="%SYMBOL_GlobalCaption_END%" my:Hint="%SYMBOL_GlobalHint_END%"/>
		<my:Option my:Value="Universal" my:Caption="%SYMBOL_UniversalCaption_END%" my:Hint="%SYMBOL_UniversalHint_END%"/>
	</my:Options>
	<my:Properties>
		<my:Property my:Name="Required" my:Value="true"/>
		<my:Property my:Name="ValuePath" my:Value="Value"/>
		<my:Property my:Name="CaptionPath" my:Value="Caption"/>
		<my:Property my:Name="HintPath" my:Value="Hint"/>
		<my:Property my:Name="ItemSource" my:Value="Custom"/>
		<my:Property my:Name="SelectedValue" my:Value="{Binding Source=object, Path=Scope, Mode=TwoWay}"/>
	</my:Properties>
</my:Control>

2. Look up in the Schema

One nice way to handle the list is to enter the values into the Verification regex of the attribute’s binding object. You can then instruct the RCDC to look the values up in the schema, and if you want to change them later there is no need to edit the RCDC. The down side to this approach is that you run up against the character limit in the validation string very quickly – so this only works for a short list of options.

By default the same validation regex is defined for both the EmployeeType attribute and binding, however this UocDropDownList control only seems to use the Binding one. This isn’t the default, but here’s an example of what you might have in the validation string:

^(Employee|External|Service|Admin)?$

Then in the RCDC you tell it that the “ItemSource” comes from the schema:

<my:Control my:Name="EmployeeType" my:TypeName="UocDropDownList" my:Caption="{Binding Source=schema, Path=EmployeeType.DisplayName}" my:Description="{Binding Source=schema, Path=EmployeeType.Description}" my:RightsLevel="{Binding Source=rights, Path=EmployeeType}">
	<my:Properties>
		<my:Property my:Name="Required" my:Value="{Binding Source=schema, Path=EmployeeType.Required}" />
		<my:Property my:Name="ValuePath" my:Value="Value" />
		<my:Property my:Name="CaptionPath" my:Value="Caption" />
		<my:Property my:Name="HintPath" my:Value="Hint" />
		<my:Property my:Name="ItemSource" my:Value="{Binding Source=schema, Path=EmployeeType.LocalizedAllowedValues}" />
		<my:Property my:Name="SelectedValue" my:Value="{Binding Source=object, Path=EmployeeType, Mode=TwoWay}" />
	</my:Properties>
</my:Control>

3. XmlDataSource

I regularly find I have too many choices to use the schema method. Unfortunately there is, as yet, no way to actively update the list of choices from, say, a database table – so I have to hard-code the options into an XmlDataSource section in my RCDC.

You can define multiple XmlDataSource sections at the top of the RCDC, before the my:Panel section. Here’s an example listing site names:

<my:XmlDataSource my:Name="Sites">
	<Sites>
		<SiteCode Code="" Name="" />
		<SiteCode Code="001" Name="Rue du Rhone, Geneva" />
		<SiteCode Code="002" Name="Place de la Concorde, Paris" />
		<SiteCode Code="003" Name="Alexanderplatz, Berlin" />
		<SiteCode Code="004" Name="Pitt St, Sydney" />
	</Sites>
</my:XmlDataSource>

I now refer to this list of options in the “ItemSource” part of my UocDropDownList control. The neat trick I’m doing here is to show the user the friendly names of the sites, but then to write the code into the object’s SiteCode attribute by specifying @Code in the “ValuePath” option.

<my:Control my:Name="SiteCode" my:TypeName="UocDropDownList" my:Caption="Site" my:Description="{Binding Source=schema, Path=SiteCode.Description}"  my:RightsLevel="{Binding Source=rights, Path=SiteCode}">
	<my:Properties>
		<my:Property my:Name="Required" my:Value="{Binding Source=schema, Path=SiteCode.Required}"/>
		<my:Property my:Name="ValuePath" my:Value="@Code"/>
		<my:Property my:Name="CaptionPath" my:Value="@Name"/>
		<my:Property my:Name="HintPath" my:Value="@Code"/>
		<my:Property my:Name="ItemSource" my:Value="{Binding Source=Sites, Path=/Sites/*}"/>
		<my:Property my:Name="SelectedValue" my:Value="{Binding Source=object, Path=SiteCode, Mode=TwoWay}"/>
	</my:Properties>
</my:Control>

3.5 XmlDataSource with String Resources

A variation on the XmlDataSource method can be seen by looking at how the Regions are specified in the default User RCDCs. You’ll see lots of tags like “%SYMBOL_FOCaption_END%” – where do these come from?

If you look on the Localization tab for the RCDC configuration you’ll see a whole bunch of XML in the String Resources field, and this is where the tags are defined. The idea here is that you can use a generic tag in the RCDC and then replace it with the localized version, however you could also use this functionality to make the option text a little easier to change.

 4. Drop-down selection of reference objects

See <a href=”http://theidentityguy.blogspot.com.au/2011/07/populating-rcdc-dropdownlist-with.html”>http://theidentityguy.blogspot.com.au/2011/07/populating-rcdc-dropdownlist-with.html</a>

 

{ 4 } Comments

  1. Paul Smith | June 26, 2012 at 1:46 am | Permalink

    Great post as usual Carol! Just a word of advice. I had big trouble copying the XML from your website. Hidden characters or something was causing the RCDC to fail. Ended up copying the EmployeeType and Country XML blocks directly from the exported RCDC. Made the required edits and works great!

    Cheers!

  2. Paul Smith | June 26, 2012 at 3:07 pm | Permalink

    Oh, and I found that you can only have 130 characters in the Schema Validation string so that could also drive which method to use.

  3. Tim | October 17, 2012 at 8:57 pm | Permalink

    Hi Carol,
    Quick question. In your 3rd example,

    Is it possible to modify it as below:

    And be able to use both the code and the newly defined ‘Zip’ value as an attribute?

    Thanks,
    Tim

  4. Carol | October 17, 2012 at 9:00 pm | Permalink

    Looks like something has been stripped from your comment

Post a Comment

Your email is never published nor shared. Required fields are marked *

Spam comments will be blocked by Akismet

*

Endep online order order buy Endep online purchase Endep online without script buy generic Endep from india buy in Endep uk where to buy Endep without a prescription Endep from canada buy 10 mg Aricept generic Aricept cost order Nizoral no visa Nizoral 200 mg buy cheap Nizoral line Nizoral on line best finpecia online pill Requip Requip free Requip uk Amitriptyline generic buy generic Amitriptyline from india where buy Lisinopril purchasing finpecia with overnight delivery Nizoral online buy saturday delivery buy Nizoral in mo how to buy Cytotec online without a rx order Aricept pharmacy buy Aricept with no prescription buy Amitriptyline no perscription cod Online us Requip how to buy Amitriptyline without a prescription buy line Amitriptyline buy Amitriptyline money buy purchase Accutane 40 mg on line no rx Accutane 40 mg sale order 40 mg Accutane online next day delivery 40 mg Accutane online buy Lisinopril pay cod Lisinopril overnight cod buy lisinopril without prescription buy lisinopril purchase Premarin cod next day delivery where buy Premarin buy Premarin online free fedex delivery Premarin cheapest place to buy Metformin purchase Metformin online generic 20mg prednisone online finpecia online overnight buy finpecia cheap buy Metformin toronto Metformin prescription buy Metformin where online Orlistat purchase cheap online Orlistat buying Orlistat ordering Orlistat online order Metformin usa online Orlistat buy buy in Orlistat uk buy prednisone topix buy prednisone youtube Orlistat toronto buy discount Orlistat line buy cheap Orlistat without prescription buying Orlistat prednisone prescription cost lisinopril buy lisinopril