Click or drag to resize

Picklist Class

Holds a collection of PicklistItem objects for use in an IField object. The set of picklists available in the application is available via the Picklists collection.
Inheritance Hierarchy
SystemObject
  NetQuarryPicklist

Namespace:  NetQuarry
Assembly:  EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax
[SerializableAttribute]
public class Picklist : ICloneable, IEAPBase, 
	ICacheable

The Picklist type exposes the following members.

Constructors
  NameDescription
Public methodPicklist
standard ctor, creates a new Picklist
Public methodPicklist(String)
Preferred constructor providing a name for the picklist in order to improve devlog warnings and for easier debugging.
Public methodPicklist(PicklistItemInfo, IAppContext)
Overloaded constructor, creates a new Picklist and populates it.
Top
Properties
  NameDescription
Public propertyComboList
Returns a string with only the displaytext items, delimted with the pipe (|) character
Public propertyCount
Returns the number of PicklistItems in the Picklist.
Public propertyDataMap
Returns a dictionary with only the Value/DisplayText of each PicklistItem item.
Public propertyDiscrim
Gets/Sets the discriminator value
Public propertyHasDiscrim
Gets whether the picklist uses a discrim. Read-only.
Public propertyItem
This object's indexer.
Public propertyItemInfo
Gets/Sets the picklist's PicklistItemInfo which maintains many aspects of the picklist including the picklist's PicklistAttrs.
Public propertyLateBound
Gets whether the picklist is set up for Late Bound use. Read-only.
Public propertyMaxTextLen
Gets the MaxLength of a display text value in the list. Note that this value is only valid after Refresh has been called.
Public propertyName
Returns the name of the pickList.
Public propertyUsesKeyClause
Gets whether the picklist uses a late bound SQL containing a KEY clause. Read-only.
Top
Methods
  NameDescription
Public methodAdd
Add a PicklistItem object to the collection.
Public methodStatic memberCacheName
Generates the fully-qualified cache name for the specified picklist item.
Public methodClear
Clears the collection.
Public methodClone
Returns a copy of the Picklist.
Public methodStatic memberCreateInstance
Creates or clones the Picklist represented by the provided PicklistItemInfo object.
Public methodDisplayTextList
Gets the delimited list of DisplayText for the items in the picklist.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetAltText
Returns the alternative text for a specified keyValue.
Public methodGetByName
Gets the PicklistItem information for the item with the specified name. Note that StandardPicklist items always have a name distinct from its text that serves as a constant. This is not necessarily true for the other picklist types.
Public methodGetDisplayText(Object, String)
Returns the display text for a specified keyValue.
Public methodGetDisplayText(Object, String, GetListOptions)
Returns the display text for a specified keyValue per the specified GetListOptions. Note that you can use GetDisplayText(String, Object, String, GetListOptions) to perform a safe lookup when it is possible that the picklist may not exist.
Public methodGetDisplayTextClip
Returns a 'clip' string of the display text separated by the delimiter. Note that duplicates will be not be included.
Public methodGetFirstValueMatch(String, String, Object)
Finds the first matching item in the collection. The search always starts at the beginning of the list. And performs an exact match search.
Public methodGetFirstValueMatch(String, String, GetListOptions, Object)
Finds the first matching item in the collection. The search always starts at the beginning of the list. And performs a starts with search, or exact match search, as specified in opts. Note that if IncludeDisabled is specified, a disabled item will only be matched if there are no matching enabled items.
Public methodGetFirstValueMatch(String, String, Boolean, Boolean, Object)
Finds the first matching item in the collection. The search always starts at the beginning of the list. And performs a starts with search, or exact match search, as specified. Note that if allowDisabled is specified, a disabled item will only be matched if there are no matching enabled items.
Public methodGetFirstValueMatchStartsWith
Finds the first matching item in the collection. The search always starts at the beginning of the list. And performs a starts with search.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetItem
Return a PicklistItem matching the specified key/discrim.
Public methodGetList
Returns the IList collection of PicklistItem items per the specified options. Note that any discrimValue comparison is case-insensitive.
Public methodGetTagString(String, String)
Returns a 'tag' string of the picklist contents.
Public methodGetTagString(String, String, PicklistTagStringFlags)
Returns a 'tag' string of the picklist contents per the specified PicklistTagStringFlags.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetValue
Returns the value of the object matching the supplied display text.
Public methodHasItems
Determines if the picklist has any items, excluding any null entry. Note that disabled and discrimmed-out items are included.
Public methodItemValueStatus(String, String)
Determine the PicklistItemStatus of a value in the picklist.
Public methodItemValueStatus(String, String, String)
Determine the PicklistItemStatus of a value in the picklist also returning the item's displayText.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodRefresh
Populates the collection.
Public methodSort
Sort the picklist per the picklist's PicklistAttrs.
Public methodSort(PicklistAttrs)
Sort the picklist per the specified PicklistAttrs.
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodEqualValue
Determines if the object value is equal to another object. If the two objects are null, then this returns true. There is special handling for guid comparisons (since a guid could be a string formatted in up to 3 different ways). If the special guid handling is not performed, then the object.Equals method is used.
(Defined by EAPUtil.)
Top
Remarks
A Picklist represents a domain-specific list of values that can be used to translate the key of an item (typically a foreign key in a database table) to a description. All IField objects have a Picklist property, but Picklists are most often used with ComboBox fields. Some aspects of a picklist are driven by that picklist's PicklistAttrs which is stored in the picklist's PicklistItemInfo object (accessible from the ItemInfo property) along with certain other picklist settings.

Picklists are of a variety of PicklistType:

  • StandardPicklist - This type of list is loaded from the metadata and supports the descriptive text in the current user’s culture (language).
  • SQL - This type of list is loaded from one of the databases (can be an operational database or the repository) and can contain 1 to 5 columns of data:
    1. Column 1 - The Key. Loaded into Value. This is what is stored in the database.
    2. Column 2 - The DisplayText. Loaded into DisplayText. This is what is displayed to the user.
    3. Column 3 - The Discrim. Loaded into Discrim. This is used to create subsets within the picklist (e.g. states for various countries).
    4. Column 4 - The Enabler. Used to control Disabled in Attributes. When this column is in the query the value is treated as an integer where zero/null means disabled and any other value means enabled.
    5. Column 5 - The Group. Loaded into Group.
  • Enum - This list is a 2 column Picklist loaded from a string type name as its source.
  • Intrinsic - These are programmatically-generated, predefined platform lists as identified in IntrinsicPicklists.
    • Countries - The set of countries as provided by the Windows System.Globalization.CultureInfo object.
    • Cultures - The set of cultures as provided by the Windows System.Globalization.CultureInfo object.
    • Currencies - The set of currencies as provided by the Windows System.Globalization.CultureInfo and RegionInfo objects.
    • DaysOfTheWeek - The set of days of the week names as provided by Windows System.Globalization for the current date culture.
    • MonthNames - The set of month names as provided by Windows System.Globalization for the current date culture.
    • Timezones - The set of timezones as obtained from the Windows registry and managed by the platform TimeZones collection.
  • NumericRange - This list is a simple numeric range (generally created dynamically).
  • Custom - This is a custom, programmatically-generated list populated using a class (derived from PicklistDynamic) that has been registered as a CustomPicklist component.

For the most part, Picklists tend to have the LimitToList attribute set. This attribute means that the list has a key (hidden) and text (displayed). For example, if you had a column in a database that held an integer ID for a customer status you might create a Picklist like this:

KeyData
0Active
1Inactive
Remarks
You can use GetList(String, GetListOptions) to programmatically iterate through the items in the picklist.
See Also