{"id":1553,"date":"2011-06-14T20:47:39","date_gmt":"2011-06-14T20:47:39","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?p=1553"},"modified":"2017-02-26T08:42:13","modified_gmt":"2017-02-26T08:42:13","slug":"listing-choices-in-rcdc-dropdowns","status":"publish","type":"post","link":"https:\/\/www.wapshere.com\/missmiis\/listing-choices-in-rcdc-dropdowns","title":{"rendered":"Listing choices in RCDC Dropdowns"},"content":{"rendered":"<p>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.<\/p>\n<p><!--more--><\/p>\n<h3>1. Hard-coded in the control<\/h3>\n<p>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:<\/p>\n<pre>&lt;my:Control my:Name=\"Scope\" my:TypeName=\"UocDropDownList\" my:Caption=\"{Binding Source=schema, Path=Scope.DisplayName}\" my:RightsLevel=\"{Binding Source=rights, Path=Scope}\"&gt;\r\n\t&lt;my:Options&gt;\r\n\t\t&lt;my:Option my:Value=\"DomainLocal\" my:Caption=\"%SYMBOL_DomainLocalCaption_END%\" my:Hint=\"%SYMBOL_DomainLocalHint_END%\"\/&gt;\r\n\t\t&lt;my:Option my:Value=\"Global\" my:Caption=\"%SYMBOL_GlobalCaption_END%\" my:Hint=\"%SYMBOL_GlobalHint_END%\"\/&gt;\r\n\t\t&lt;my:Option my:Value=\"Universal\" my:Caption=\"%SYMBOL_UniversalCaption_END%\" my:Hint=\"%SYMBOL_UniversalHint_END%\"\/&gt;\r\n\t&lt;\/my:Options&gt;\r\n\t&lt;my:Properties&gt;\r\n\t\t&lt;my:Property my:Name=\"Required\" my:Value=\"true\"\/&gt;\r\n\t\t&lt;my:Property my:Name=\"ValuePath\" my:Value=\"Value\"\/&gt;\r\n\t\t&lt;my:Property my:Name=\"CaptionPath\" my:Value=\"Caption\"\/&gt;\r\n\t\t&lt;my:Property my:Name=\"HintPath\" my:Value=\"Hint\"\/&gt;\r\n\t\t&lt;my:Property my:Name=\"ItemSource\" my:Value=\"Custom\"\/&gt;\r\n\t\t&lt;my:Property my:Name=\"SelectedValue\" my:Value=\"{Binding Source=object, Path=Scope, Mode=TwoWay}\"\/&gt;\r\n\t&lt;\/my:Properties&gt;\r\n&lt;\/my:Control&gt;<\/pre>\n<h3>2. Look up in the\u00c2\u00a0Schema<\/h3>\n<p>One nice way to handle the list is to enter the values into the Verification regex of the attribute&#8217;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 &#8211; so this only works for a short list of options.<\/p>\n<p>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&#8217;t the default, but here&#8217;s an example of what you might have in the validation string:<\/p>\n<p>^(Employee|External|Service|Admin)?$<\/p>\n<p>Then in the RCDC you tell it that the &#8220;ItemSource&#8221; comes from the schema:<\/p>\n<pre>&lt;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}\"&gt;\r\n\t&lt;my:Properties&gt;\r\n\t\t&lt;my:Property my:Name=\"Required\" my:Value=\"{Binding Source=schema, Path=EmployeeType.Required}\" \/&gt;\r\n\t\t&lt;my:Property my:Name=\"ValuePath\" my:Value=\"Value\" \/&gt;\r\n\t\t&lt;my:Property my:Name=\"CaptionPath\" my:Value=\"Caption\" \/&gt;\r\n\t\t&lt;my:Property my:Name=\"HintPath\" my:Value=\"Hint\" \/&gt;\r\n\t\t&lt;my:Property my:Name=\"ItemSource\" my:Value=\"{Binding Source=schema, Path=EmployeeType.LocalizedAllowedValues}\" \/&gt;\r\n\t\t&lt;my:Property my:Name=\"SelectedValue\" my:Value=\"{Binding Source=object, Path=EmployeeType, Mode=TwoWay}\" \/&gt;\r\n\t&lt;\/my:Properties&gt;\r\n&lt;\/my:Control&gt;<\/pre>\n<h3>3. XmlDataSource<\/h3>\n<p>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 &#8211; so I have to hard-code the options into an XmlDataSource section in my RCDC.<\/p>\n<p>You can define multiple XmlDataSource sections at the top of the RCDC, before the my:Panel section. Here&#8217;s an example listing site names:<\/p>\n<pre>&lt;my:XmlDataSource my:Name=\"Sites\"&gt;\r\n\t&lt;Sites&gt;\r\n\t\t&lt;SiteCode Code=\"\" Name=\"\" \/&gt;\r\n\t\t&lt;SiteCode Code=\"001\" Name=\"Rue du Rhone, Geneva\" \/&gt;\r\n\t\t&lt;SiteCode Code=\"002\" Name=\"Place de la Concorde, Paris\" \/&gt;\r\n\t\t&lt;SiteCode Code=\"003\" Name=\"Alexanderplatz, Berlin\" \/&gt;\r\n\t\t&lt;SiteCode Code=\"004\" Name=\"Pitt St, Sydney\" \/&gt;\r\n\t&lt;\/Sites&gt;\r\n&lt;\/my:XmlDataSource&gt;<\/pre>\n<p>I now refer to this list of options in the &#8220;ItemSource&#8221; part of my UocDropDownList control. The neat trick I&#8217;m doing here is to show the user the friendly names of the sites, but then to write the code into the object&#8217;s SiteCode attribute by specifying @Code in the\u00c2\u00a0&#8220;ValuePath&#8221; option.<\/p>\n<pre>&lt;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}\"&gt;\r\n\t&lt;my:Properties&gt;\r\n\t\t&lt;my:Property my:Name=\"Required\" my:Value=\"{Binding Source=schema, Path=SiteCode.Required}\"\/&gt;\r\n\t\t&lt;my:Property my:Name=\"ValuePath\" my:Value=\"@Code\"\/&gt;\r\n\t\t&lt;my:Property my:Name=\"CaptionPath\" my:Value=\"@Name\"\/&gt;\r\n\t\t&lt;my:Property my:Name=\"HintPath\" my:Value=\"@Code\"\/&gt;\r\n\t\t&lt;my:Property my:Name=\"ItemSource\" my:Value=\"{Binding Source=Sites, Path=\/Sites\/*}\"\/&gt;\r\n\t\t&lt;my:Property my:Name=\"SelectedValue\" my:Value=\"{Binding Source=object, Path=SiteCode, Mode=TwoWay}\"\/&gt;\r\n\t&lt;\/my:Properties&gt;\r\n&lt;\/my:Control&gt;<\/pre>\n<h3>3.5 XmlDataSource with String Resources<\/h3>\n<p>A variation on the XmlDataSource method can be seen by looking at how the Regions are specified in the default User RCDCs. You&#8217;ll see lots of tags like &#8220;%SYMBOL_FOCaption_END%&#8221; &#8211; where do these come from?<\/p>\n<p>If you look on the Localization tab for the RCDC configuration you&#8217;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\u00c2\u00a0a little easier to change.<\/p>\n<h3>\u00c2\u00a04. Drop-down selection of reference objects<\/h3>\n<p>See &lt;a href=&#8221;http:\/\/theidentityguy.blogspot.com.au\/2011\/07\/populating-rcdc-dropdownlist-with.html&#8221;&gt;http:\/\/theidentityguy.blogspot.com.au\/2011\/07\/populating-rcdc-dropdownlist-with.html&lt;\/a&gt;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[42,51],"tags":[],"class_list":["post-1553","post","type-post","status-publish","format-standard","hentry","category-fim-2010","category-rcdc"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pkp1o-p3","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/1553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=1553"}],"version-history":[{"count":10,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/1553\/revisions"}],"predecessor-version":[{"id":2822,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/1553\/revisions\/2822"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=1553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/categories?post=1553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/tags?post=1553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}