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

*

buy next day metformin prednisone oral tablet no prescription discount buy cheapest metformin prezzo premarin premarin drug i want to buy pregnizone without a prescription buy arimidex online us pharmacy buy premarin where synthroid non rx fedex overnight free buy synthroid generic premarin delivered overnight prescription finasteride online finasteride non prescription requip prices buy premarin where purchase online arimidex without rx where to purchase generic premarin online without a prescription arimidex mexico buy online premarin without rx buy no online rx valacyclovir purchase premarin without a rx online online pharmacy premarin where can i buy prednisone cheap orlistat no prescription purchase arimidex amex online without rx buy arimidex on line cheap premarin by money order requip online prescription arimidex cheap mexican purchase synthroid no visa without prescription where can i buy requip synthroid overnight no consult buy finasteride without buy cheap metformin with dr. prescription metformin metformin buy synthroid online with overnight delivery synthroid c.o.d. buy finpecia no prescription buy arimidex with no prescription buy no perscription premarin finasteride with free fedex overnight online pharmacy finasteride no prescription canada requip buy orlistat oral purchase finasteride online with overnight delivery generic synthroid tablets buy premarin diet pill prednisone fedex canadian synthroid diet pills without a prescription finasteride free consultation fedex overnight delivery order orlistat without rx where can i buy some prednisone online only using cash or money orders buy mail order arimidex cheap arimidex no rx non presciption finasteride buying synthroid without a prescription requip buy buy prednisone without a percsription buy cheap lisinopril without prescription no rx arimidex buy cheap seroquel online buy metformin in the uk order cheap overnight finasteride premarin delivered overnight synthroid no dr synthroid without a prescription or membership buy premarin where order buy requip online premarin mexico buy finpecia online paypal buy seroquel money buy premarin buy fedex c.o.d synthroid prednisone with out a prescription buy in metformin uk next day delivery on premarin saturday metformin canadian pharmacy prednisone online finasteride order online no membership overnight purchase cheap online lisinopril where to purchase cheap lisinopril no rx buy synthroid overnight delivery synthroid shipped c.o.d. buy prednisone no prescription valacyclovir requip