MPage Select Component
The MPage Select component has been designed to greatly reduce the workload of populating data into a drop-down select box while offering advanced features such as real-time searching and limiting content on large lists. Featuring built-in support for code value, personnel searches, in-memory lists and custom script population, the MPage Select component can handle a wide array of applications.
Implementation
The MPage select component is added with the <mpage-select></mpage-select> element in your HTML portion of your Angular component. The table below identifies all the options available.
This component offers four types of data that can be displayed and is controlled by the options you set during your implementation. The options that control the data type are:
- codeSet: Provides code set/code value lookup.
- script: Uses your own CCL script to generate values.
- values: Hard-coded list of values to provide in component.
- physicianInd assigned and nothing set for codeSet, script or values: Generates a personnel/provider search.
Options Grid
Item | Binding | Data Type | Default | Description |
---|---|---|---|---|
allOption | Input | boolean | false |
If set to true, a new item is added to the select component titled "All Values" which when chosen by the user sends a value of -1 back to your CCL script. When selected by the user, all other selected values on the component are de-selected. The purpose of this feature is to allow you the ability to send a single value of -1 to your CCL script instead of every selected value of your select box. |
class | Input | string | Allows you the ability to pass your own CSS class names to control output. Typical use would be to control the width of your select field. | |
codeSet | Input | number | 0 | Indicates a code set to be used for the select control. If the code set has been previously loaded through the CodeSetService it will use those values. If not loaded, the code set will be read as needed by the component honouring any limits you may have set for the component. |
codeSetLimits | Input | string[] | [] | Paired with the codeSetLimitType option, this field restricts the code values returned by the listed values. For example, limits on code set 319 might be ["FIN NBR","MRN"]. |
codeSetLimitType | Input | string | CDF_MEANING | This option indicates which field from the code set should be checked when performing a codeSetLimits restriction. This option only functions when codeSetLimits have been set on a codeSet select. Permitted values are: "CDF_MEANING", "DISPLAY", "DISPLAY_KEY", "DESCRIPTION", "DEFINITION", "CKI", and "CONCEPT_CKI". |
label | Input | string | Label you wish to present to your users to describe the component. | |
multiple | Input | boolean | false | Indicates if multiple items can be chosen by the user in the select control. |
noOption | Input | boolean | false | If set to true, a new select option titled "No value" with a key value of 0 will be added to the select control. This value can then be intercepted in your CCL code to handle cases where the user wants to choose records that do not have a value assigned. |
physicianInd | Input | boolean | unassigned | When you have not assigned a value for the values, codeSet and script parameters your component will become a personnel search control. Setting physicianInd to true will further limit the control to only search for prsnl records where the physician_ind field is equal to 1. |
hintLabel | Input | string | Displays extra instructions below your select component. | |
script | Input | string | Name of your custom CCL script. If your code is compiled as group1 it should also be indicated (e.g. my_ccl_script:group1). See instructions below on how to configure your custom CCL script. | |
searchAhead | Input | number | 3 | Provides a minimum number of characters a user must type when performing a search in the component. |
searchable | Input | boolean | false | Determines if users can search for specific values in the component. Should be set to true if the searchLimit value is less than the number of records available to the list. |
searchLimit | Input | number | 100 | Determines how many records can be included in the list at one time. If the number of records exceeds the search limit value, the user will see a notification message on the component. A value of 0 indicates that all records should be loaded. |
values | Input | ISelectValue[] or string[] | [] | Allows passing a hard-coded array of either string values or ISelectValue values. Can be used when your list of values is not sourced from a Cerner table. |
valueType | Input | string | display | Determines the field to output when using a codeSet select component. Valid values are 'display', 'display_key', 'description', and 'definition'. |
ngModel | Input/Output | number[] | The numerical array which contains your select values. |
Examples
// Basic select list with Name, Birth Date and Gender as options
<mpage-select label="Sort by" [(ngModel)]="selectTest1" [values]="['Name','Birth Date','Gender']"></mpage-select>
// Code Set 72 select with content control and multiple selection
<mpage-select label="Event" [(ngModel)]="selectTest2" [codeSet]="72" [multiple]="true" [searchable]="true"
[allOption]="true" hintLabel="There are too many events to list them all."></mpage-select>
// All providers
<mpage-select label="Provider" [(ngModel)]="selectTest3" [physicianInd]="true" [multiple]="true"></mpage-select>
// Custom CCL script that returns note types (demo only, script not part of Clinical Office)
<mpage-select label="Note Type" [(ngModel)]="selectTest4" script="1js_all_mp_note_types" [multiple]="true"
[searchable]="true" class="w10rem" [searchLimit]="300" [allOption]="true"></mpage-select>
Custom CCL Scripts
The easiest way to create an MPage Select custom CCL script is to start with a copy of the template script found in your Clinical Office CCL distribution. The template script is called 1co_mpage_select_template.prg
The template script has code to handle defining the output rCustom record structure as well as containing handlers for the incoming parameters. Line 102 is where your custom content will begin.
The first step is to modify the parser to handle your search parameters and any default values being passed in. Replace the value ***COMPARISON DB FIELD*** with the aliased database field you will be using in your SELECT statement.
In our explanation, we are going to use the CODE_VALUE table which has been aliased as CV to help demonstrate the changes you need to make.
; Custom parser declarations declare cParser = vc with noconstant("1=1") ; Build the parser for user search if (rParam->search_value != "") set cParser = concat(^cnvtupper(cv.code_value) = patstring(|^, rParam->search_value, ^*|)^) ; Build a parser for default values elseif (rParam->search_limit > 0 and size(rParam->default, 5) > 0) set cParser = ^expand(nNum, 1, size(rParam->default, 5), cv.code_value, rParam->default[nNum])^ set nDefault = 1 endif
The second step is to write a SELECT statement that limits the number of returning rows. In this code you should only modify the content between row_count = count( and the detail statement. In this statement you need to replace the values for ***COMPARISON DB FIELD***, ***YOUR TABLES***, ***YOUR ALIAS*** and add in your SQL code that makes your script unique.
; Perform a limit check to determine if too many values exist to upload ; --------------------------------------------------------------------- if (rParam->search_limit > 0) ; Perform your select to count the results you are after select into "nl:" row_count = count(cv.code_value) from code_value cv plan cv where cv.code_set = 220 and cv.cdf_meaning = "NURSEUNIT" and parser(cParser) and cv.active_ind = 1 ; WARNING: Avoid modifying the detail section below or your code may fail detail if (row_count > rParam->search_limit) rCustom->status->error_ind = 1 rCustom->status->message = concat(build(cnvtint(row_count)), " records retrieved. Limit is ", build(rParam->search_limit), ".") endif rCustom->status->count = row_count with nocounter endif
The final step is to collect your data. Simply repeat your SQL from the previous section without the row_count variable and modify the detail section to assign your key and value parameters.
; Perform the load if search limit does not fail if (rCustom->status->error_ind = 0 or nDefault = 1) set rCustom->status.message = "No records qualified." select into "nl:" from code_value cv plan cv where cv.code_set = 220 and cv.cdf_meaning = "NURSEUNIT" and parser(cParser) and cv.active_ind = 1 order cv.display_key head report rCustom->status.message = "Ok." nCount = 0 ; WARNING: Detail section must write to rCustom->data[].key and rCustom->data[].value detail nCount = nCount + 1 stat = alterlist(rCustom->data, nCount) rCustom->data[nCount].key = cv.code_value rCustom->data[nCount].value = cv.display with counter, expand=2 endif
Your CCL script should now be ready to use.
Interfaces
ISelectValue
interface ISelectValue { key: any, value: any }