KBA-01077: Customizing Code List Filters

Question:

How can I control the choices in drop-down lists (i.e., pick lists), or reuse codes from one Doc type for other Doc types?

Answer:

In sfPMS, choices for drop-down lists are data driven.  You can specify the choices for each drop-down using the Code Maintenance tool on the System Admin Dashboard. Many code sets are Doc type-specific, allowing you to use different labels in drop-downs on different documents, for example, Approved as a status choice for Purchase Orders and Agenda as a status choice for Meeting Minutes.  Generally, the Doc type-specific codes allow ‘common‘ choices to be merged—such as Closed for all Doc types. Of course, there are always exceptions to the general cases, and times when two or more Doc types (perhaps Bid Package and RFQ) should share a set of choices that are inappropriate for the rest of the documents.

In order to provide as much flexibility as possible, the code sets are filtered.  The filter used is constructed at runtime based upon the input of rules.  You can maintain these rules using the Rules Maintenance tool on the System Admin Dashboard.  The default code set filter is
Setname = ‘$FILTER$‘
and (DocTypeKey =‘00000000-0000-0000-0000-000000000000‘ OR DocTypeKey =‘$DOCTYPE$‘ )

The code list rule groups available in System Admin Dashboard | Rules Maintenance tool are:

CodeSetRedirect

Lists the code sets + Doc type combinations that should be redirected to another Doc type. This rule group is applied at the end of the filter creation and affects the value substituted for the $DOCTYPE$ placeholder. For example, a rule entry might be used to redirect Bid choices to those already established for the Bid Request.  Use DocStatus as the Rule, Bid as the filter value and Bid Request as the Result Value.  Note that this rule is rendered inoperative if the base filter does not include the $DOCTYPE$ placeholder.  See also KBA-01661.

ExcludeCommonChoices

Lists the code sets + Doc type combinations that exclude common choices / items from standard Code Set filters.   For example, to restrict Forecast documents to their Doc type-specific status choices, use DocStatus as the Rule, Forecast as the filter value and checkmark as the Result Value.  See also KBA-01023.

ItemCodeLike

Lists the Item code sets + Doc type combinations that filter available choices based upon a document code field. Use this rule group when you want the possible choices for a Document Item drop-down to be limited by a previous choice entered in a drop-down on the Document Detail tab. This rule adds

CODE LIKE TRIM( DocMasterDetail.$$RESULTVALUE$$) + '%'

For example, the ItemType drop-down choices on Permits might be restricted based upon Subtype.  Use ItemType as the Rule, Permit as the rule filter and Subtype as the Result Value.  See also KBA-01662.

CodeSetFilterOverride

Overrides the default system-generated filter for drop-down choices. Use this rule group as a last resort: improper use can cause runtime errors. If you use this rule group, ExcludeCommonChoices no longer applies since you can factor that into your own base filter. The ItemCodeLike and CodeSetRedirect rules are applied. Note that $DOCTYPE$ can be used as a placeholder for the document type. The placeholder must be used if you also use CodeSetRedirect rules. For example, to have the Bid status choices further restricted to a specific set of codes, use DocStatus as the Rule, Bid as the Filter Value and the Result Value below:
Setname = ‘$FILTER$’ and DocTypeKey =’$DOCTYPE$’ and Code IN (‘D’, ‘O’, ‘G’)
You can also filter to exclude obsolete codes:

Setname = ‘$FILTER$’ and DocTypeKey =’$DOCTYPE$’ and Code NOT IN (‘C’, ‘A’, ‘T’)

Additional Comments:

Note 1: The Reference List and Date Type List are not accessed in Code Maintenance but you can still use DocReference or DateList as Rules. See KBA-01023.

Note 2: SITECONFIG.XML takes precedence over these rules, so if you have overridden a code set filter in SITECONFIG.XML, these rules do not apply.


KBA-01077;  Last updated: December 17, 2020 at 9:36 am; 
Keywords:  rules