DMInfo Details
CustomService offers a method called executeDmInfoAction which offers the ability to read, write and delete records from the DM_INFO table.
DM_INFO is a table in Cerner suitable for storing small volumes of patient or reference data. If you plan on storing significant amounts of data we highly suggest you create your own custom tables and use the CustomService service to communicate between your CCL and your MPage.
Required Parameters
-
id: string
The id parameter represents the name which your data will be stored under in the CustomService service. Passing a value of '' will result in no data being returned back to the MPage. Omitting this value will typically only be used during a write or delete action if you do not desire to have data returned.
-
action: string
There are three possible action values which are 'r', 'w' and 'd'. 'r' represents a read action, 'w' a write or update action and 'd' represents a delete action.
-
data: IDmInfo[]
The data parameter represents an array of IDMInfo objects that contain the basic structure of the DM_INFO table and associated LONG_TEXT record.
interface IDmInfo { infoDomain: string; infoName: string; infoDate: Date; infoChar: string; infoNumber: number; infoLongText: string; infoDomainId: number; }
The infoDomain, infoName and infoDomainId fields are key fields and should be used to uniquely identify your application, data identifier and unique id.
-
callback: any = undefined
The optional callback method allows calling code immediately after execution of the DMInfo action has occurred. See "Read Example #1" below for an example of how to use the callback parameter.
Usage Examples
The following examples assume that you have already assigned the CustomService to an object called custom.
Read Example #1In this example, we are going to read all values for an infoDomain called "Patient Dashboard" and assign the returning CustomService data variable a name of dashboardData. Using a callback we are going to assign a variable called dashboardReady to true.
public dashboardReady = false; ngOnInit(): void { this.customService.executeDmInfoAction('dashboardData', 'r', [ { infoDomain: 'Patient Dashboard', infoName: '', infoDate: new Date(), infoChar: '', infoNumber: 0, infoLongText: '', infoDomainId: 0 } ], () => { this.processDashboardData() }); } processDashboardData(): void { this.customService.putLog('This only runs if data exists for the read action.'); this.dashboardReady = true; }Read Example #2
In this example, we are going to use the same "Patient Dashboard" infoDomain value but additionally filter by an infoName value called 'colorScheme' and assign the returning CustomService data variable a name of dashboardColorScheme.
this.customService.executeDmInfoAction('dashboardColorScheme', 'r', [ { infoDomain: 'Patient Dashboard', infoName: 'colorScheme', infoDate: new Date(), infoChar: '', infoNumber: 0, infoLongText: '', infoDomainId: 0 } ]);Read Example #3
The previous read example for colorScheme wasn't too bad however it would only be useful for global color settings. Imagine if you wanted to offer your users storage of personalized values. This would be done by including the personId of the current user as a value in the infoDomainId property. Assuming you have assigned the mPageService to an object, you could access the prsnlId object and pass it to your data object.
this.customService.executeDmInfoAction('dashboardColorScheme', 'r', [ { infoDomain: 'Patient Dashboard', infoName: 'colorScheme', infoDate: new Date(), infoChar: '', infoNumber: 0, infoLongText: '', infoDomainId: this.mpage.prsnlId } ]);Write Example
Writing is as simple as reading. Just ensure that you have at least an infoDomain, infoName and infoDomainId available. If your values do not require and infoDomainId (e.g. Global value), simply pass a 0 for infoDomainId.
If you include any text for infoLongText, an associated LONG_TEXT record will be created. If you are storing text and don't need many characters, simply use the infoChar field instead of infoLongText.
In the example below we will store a color scheme in the infoChar field for our prsnlId. On first execute, an INSERT will be performed and all subsequent executions will UPDATE the record.
this.customService.executeDmInfoAction('dashboardColorScheme', 'w', [ { infoDomain: 'Patient Dashboard', infoName: 'colorScheme', infoDate: new Date(), infoChar: '{menu: "hotpink", background: "aqua", font: "blue"}', infoNumber: 0, infoLongText: '', infoDomainId: this.mpage.prsnlId } ]);Delete Example
Deleting a row requires unique values for infoDomain, infoName and infoDomainId. Any associated LONG_TEXT records will be inactivated however the DM_INFO record being deleted will permanently be removed.
The example below will delete the color scheme created above.
this.customService.executeDmInfoAction('dashboardColorScheme', 'd', [ { infoDomain: 'Patient Dashboard', infoName: 'colorScheme', infoDate: new Date(), infoChar: '', infoNumber: 0, infoLongText: '', infoDomainId: this.mpage.prsnlId } ]);
emptyDMInfo Template Object
The emptyDMInfo get method can be called to return a unpopulated dmInfo record. Properties can be then modified and passed to executeDmInfoAction.
For example:
const dmAction = this.customService.emptyDmInfo; dmAction.infoDomain = 'Patient Dashboard'; this.custom.executeDmInfoAction('dashboardColorScheme', 'r', [dmAction]);
Execute multiple actions in the same payload with executeDmInfoActions
Sometimes you may wish to run multiple dm_info actions sequentially in the same payload. For example, you may have a write operation you wish to perform followed by a read operation. The executeDmInfoActions method will allow this.
The syntax is similar to executeDmInfoAction except all parameters are stored in an array.
The example below will execute a write under the name dashboardColorScheme followed by a read operation called dashboardData.
this.customService.executeDmInfoActions([ { sId: 'dashboardColorScheme', sAction: 'w', dData: [{ infoDomain: 'Patient Dashboard', infoName: 'colorScheme', infoDate: new Date(), infoChar: '{menu: "hotpink", background: "aqua", font: "blue"}', infoNumber: 0, infoLongText: '', infoDomainId: this.mpage.prsnlId }] }, { sId: 'dashboardData', sAction: 'r', dData: [{ infoDomain: 'Patient Dashboard', infoName: 'colorScheme', infoDate: new Date(), infoChar: '', infoNumber: 0, infoLongText: '', infoDomainId: 0 }] } ]);
The code above could have been shortened considerably by using the emptyDmInfo() method.