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

*

generic 1mg Finpecia online Arimidex cheap online canadian pharmacy Finasteride without a prescription or Buy Finasteride without a prescription to ship overnight Finasteride overnight us delivery purchase Finasteride visa buy cheapest Cytotecbuy no prior prescription Cytotec Tamoxifen for sale Furosemide 40 mg without prescription Cytotec no prescription to buy buy Requip 2mg order Seroquel online canada buy Clomiphene australia buy Seroquel generic order no prescription Metformin online Requip buy Seroquel purchase overnight delivery Seroquel no prescription needed 50mg buy seroquel online without prescription from canada no prescription generic seroquel seroquel for sale canadian pharmacy no prescription seroquel buy seroquel online uk buy seroquel 25 mg seroquel online 50mg how to buy seroquel online seroquel online uk seroquel 50mg canada buy generic seroquel seroquel no script seroquel online without a prescription can you buy seroquel online buy seroquel usa buy seroquel in canada Prednisone on line buy Prednisone overnight buy cheap Prednisone online free consult buy Prednisone on line amex uk buy Prednisone buy cod Prednisone order overnight Prednisone medikament Prednisone Prednisone order online buy Prednisone no scams buy Prednisone mastercard online purchase Prednisone buy cheap Prednisone no prescription buy Prednisone amex online without rx buy Prednisone canada purchasing Prednisone without a script where to buy generic Prednisone online without a prescription Prednisone drug non rx cheap Prednisone order Prednisone cheap overnight fedex Prednisone overnight without a prescription buy Prednisone 20 mg buy Prednisone where Prednisone without prescription overnight shipping purchasing Prednisone without a script Prednisone without rx overnight shipping where to purchase Prednisone no prescription no fees Prednisone online overnight delivery cod Prednisone prescription order order Prednisone without rx from us pharmacy buy Prednisone pills in toronto buy Prednisone online online pharmacies Prednisone buy Prednisone no prescriptions buy Prednisone once a day order Prednisone pay pal online without rx buy Prednisone where buy line Prednisone best finpecia online pill Cytotec purchase overnight delivery where buy Lisinopril purchasing finpecia with overnight delivery how to purchase Requip buy Arimidex no prescription fast delivery no prescription generic Requip Requip generic names Requip ordering buy Requip in the us Arimidex 1 mg order online Requip 0,5 mg without a prescription Arimidex tablets 1 mg no prescription australia Arimidex 1mg tablets express shipping buy Requip online australia ordering Requip from canada without a prescription buy Requip online without a prescription buy Requip pills no prescription Requip generic no prescription Lisinopril overnight cod cheap order rx metformin prednisone 40 mg cheapest place to buy Metformin purchase Metformin online Maxalt no prescription needed 10mg Maxalt 10mg canada where to buy Maxalt uk buy generic Maxalt canada buy metformin cod discount Cytotec order Cytotec uk purchase Cytotec online no membership overnight shipping best Cytotec online pill Valacyclovir Cytotec want to buy Cytotec in usa Cytotec online overnight delivery cod buy cytotec with a mastercard order Cytotec no rx how to order Cytotec online without a rx how to buy Metformin without a prescription Metformin price buy Alli without prescription