Initial Checking with all 820 MLMs

This commit is contained in:
2020-02-02 00:54:01 -05:00
parent c59dc6de2e
commit 840d0432f4
828 changed files with 239162 additions and 0 deletions

View File

@@ -0,0 +1,336 @@
maintenance:
title: Generic Form Control for Order Sets;;
mlmname: FORM_Set_Generic_Item_Control;;
arden: version 2;;
version: 5.00;;
institution: St Clair;;
author: Shawn Head, Eclipsys Corp ext 7468;;
specialist: Shawn Head, Eclipsys Corp ext 7468;;
date: 2012-05-22;;
validation: testing;;
library:
purpose: Used to control grid items on order set forms.
;;
explanation: This MLM was developed to be used by the analysts to disable, enable, auto-select items on an order set
This will be accomplished by adding this generic MLM to the form field they want to trigger the MLM and then
using the Generic MLM configuration tool to develope the logic that needs added to the MLMGenericItemControl
item added to the end of the order set.
Change history
5-22-2012 STH - Copied Robert Spences MLM "FORM_Set_Generic_ReadOnly" to use as template.
8-28-2012 STH - CSR 30659 - Updated to add additional functionality and removed unnecessary code
1-23-2013 STH - CSR 31231 - Updated to add additional functionality for auto selecting "same name" items in the same grid
Also standarized the logic and configuration.
3-5-2013 STH - CSR 31231 - Updated to correct conflicting logic. Now MLM will process all "selected items" and then
circle back around to verify which items are still active and "de-selected" and then process
any required logic for the de-selected item configuration.
4-11-2013 STH - CSR 31297 - Update and validate the de-select logic section in the code to verify accuracy of functionality.
;;
keywords: Generic, FormOpen, Read Only, update items, CPOE, CPOE updates, CPOE items
;;
knowledge:
type: data-driven;;
data:
// This MLM is passed three arguments, of types
// communication_type, form_type and client info object respectively.
(this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := FALSE;
LegendIn := ();
LegendOut := ();
LegendIn := ("MOI","MOC","MOG","FO");
LegendOut := ("MultiOrderInline","MultiOrderCheckbox","MultiOrderGrid","FormOpen");
// Use String parse
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; //used to parse string data into a list
call_mlm_logic := mlm {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_LOGIC{{{SINGLE-QUOTE}}};
// Initialize error message
error_message:="";
// get the list of configured items to be updates based on the form item MLMGenericItemControl
field_list:= this_form.fields;
//build the variable "workfield" to have the datavalue from alldataitem(s) MLMGenericItemControl added to form
//this variable will be used to identify how to handle items on this form based on the configuration added.
// workfield will be in format aaa^b^xxx,xxx,xxx^y|aaa^b^xxx,xxx,xxx^y
// where aaa is one of MOI, MOC, MOG (MultiOrderInLine, MultiOrderCheckBox, or MultiOrderGrid)
// b is the occurrence number of the Inline, Check Box or Grid that has been added to the form.
//xxx,xxx,xxx is the list of "orderitems" from the orderitem catalog that will be added to the grid that need to trigger the MLM
//y will either be YES or NO depending on if the configuration should be single item select or not.
workfield2 := (field_list where field_list.DataItemName = "MLMGenericItemControl" );
ctusrcfgitems := count workfield2;
workfield := "";
for x in (1 seqto (ctusrcfgitems)) do
if workfield = "" then
if workfield2[x].value <> "" and workfield2[x].value is not null then
workfield := workfield2[x].value;
endif;
else
if workfield2[x].value <> "" and workfield2[x].value is not null then
workfield := workfield || workfield2[x].value;
endif;
endif;
enddo;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
//create a list to be used to store ALL items assigned to the calling form item (MOG, MOI, MOC)
calling_itemlist := ();
calling_itemcheck := ();
cfgcallorders := ();
cfgupdateorders := ();
//identify the "Control_MultiFieldOccNum" associated with the MultiOrder### (Grid, Item, Checkbox)
//based on the field calling the MLM. e.g (MultiOrderGrid(3) will return 3 in mfon and MultiOrderGrid for mfname
callfieldlgth := length of CallingField;
findpipe := FIND "|" IN STRING CallingField;
itemctlenght := callfieldlgth - findpipe;
itemstartpos := findpipe + 1;
mfon := substring itemctlenght characters starting at itemstartpos from CallingField;
mfname := substring callfieldlgth-itemctlenght-1 characters starting at 1 from CallingField;
//get the list of items in the MultiOrder field that called the MLM
calling_itemflds := last of (field_list where field_list.DataItemName = mfname
and field_List.Control_MultiFieldOccNum = (mfon as number));
calling_itemlist := calling_itemflds.Value;
calling_itemcheck := calling_itemlist.IsSelected;
calling_itemname1 := calling_itemlist.name;
//The Form only opens once so set the mfon to 1 for anytime the calling action is formopen
if (CallingEvent = "FormOpen") then
mfname := "FormOpen";
mfon := 1;
endif;
mlmconfigselecteditems := "";
mlmconfigdeselecteditems := "";
//------------------------------BEGIN SECTION 1---------------------------------------------
//search through the configuration added to the MLMGenericItemControl dataitem on the form and find the configuration matching
//the item that called the MLM. If you add this MLM to a MultiOrderGrid(30) this logic will search through the configuration
//added to the Data Value of the MLMGenericItemControl(s) dataitmes and find the entry for the correct configuration for the item that
//called the MLM. Once found it will set the variable for the calling items details and the update item details based on the configuration
for x in (1 seqto count LegendOut) do
//-----------------------------BEGIN SECTION 2--------------------------------------------
//This will verify that the calling form fields is one of the valid configured fields that can be used with this MLM
if mfname = LegendOut[x] then
matchconfig := LegendIn[x];
ListFields:=();
ListFields:= call str_parse with workfield,"|";
//---------------------BEGIN SECTION 3--------------------------------------------------
//loop through all configuration items added to MLMGenericItemControl and update form/grid/items based on configured logic.
//Each configuration section will be everything between the | is considered 1 configuration element/item.
for z in (1 seqto count ListFields) do
findconfigitem:= call str_parse with ListFields[z],"_";
cfgcallitemdtl := call str_parse with findconfigitem[1],"^";
//------------------BEGIN SECTION 4--------------------------------
//set these variables equal to the specific item/segment of the configuration
if ((cfgcallitemdtl[1] = matchconfig) and ((cfgcallitemdtl[2] = mfon) or ((cfgcallitemdtl[2] as number) = (mfon as number)))) then
cfgupdateitemdtl := call str_parse with findconfigitem[2],"^";
cfgcallitemtype := cfgcallitemdtl[1];
cfgcallitemnum := cfgcallitemdtl[2];
cfgcallorders := call str_parse with cfgcallitemdtl[3],",";
cfgcallsingleonly := cfgcallitemdtl[4];
else
cfgcallitemtype := null;
cfgcallitemnum := null;
cfgcallorders := null;
cfgcallsingleonly := null;
endif;
//------------------END SECTION 4--------------------------------
//--------------------BEGIN SETCTION 5-----------------------------------
//if there is at least 1 calling order item then set the list "call_itemlist2" equal to the value specific to that order item
//name in the grid
call_itemlist2 := ();
if (cfgcallorders[1] <> "") then
if (cfgcallsingleonly = "YES") then
call_itemlist2 := calling_itemflds.Value where calling_itemflds.Value.name is in cfgcallorders;
else
call_itemlist2 := calling_itemflds.Value where calling_itemflds.Value.name is in cfgcallorders and calling_itemflds.Value.IsReadOnly = false;
endif;
elseif cfgcallitemtype <> "" and cfgcallitemnum <> "" then
//if there are no order items defined in the configuration
// and there is a calling itemtype and number defined
//in the MLMGenericItemControl assume the calling item
//list is inclusive of all items added to the grid item that called this MLM
call_itemlist2 := calling_itemflds.Value;
endif;
//--------------------END SETCTION 5-----------------------------------
//build a list of item names and readonly values for those items
//so the MLM can verify at least 1 of the calling items are enabled.
//This allows for the MLM to only act on configuration and items
//that are enabled in the grid. This helps prevent contradicting
//configurations from overwritting as the MLM loops through all
//the configurations in MLMGenericItemControl
call_itemselected2 := ();
call_itemname2 := call_itemlist2.name;
call_itemenabled2 := call_itemlist2.Isreadonly;
callitemsreadonly := call_itemenabled2 where call_itemenabled2 = true;
itemct := count(call_itemname2);
roct := count(callitemsreadonly);
//-----------------BEGIN SECTION 6---------------------------------------
//Now we verify that there is at least 1 item in the call_itemname2 list
//and also verify that at least 1 item is enabled by comparing the
//number of items in the call_itemname2 list against the number of items
//in the callitemsreadonly list. If both lists are equals then this means
//that all items added to call_itemname2 are disabled so they could not have
//called the MLM so dont continue with any more logic in this section.
if itemct > 0 and (count(call_itemname2) > count(callitemsreadonly)) then
//Create a new list for the selection status of the calling item(s)
callitemselectedyn := false;
call_itemselected2 := call_itemlist2.IsSelected;
//cycles through all the items that were added to the list "call_itemselected2" and verifies if ANY of them are selected. if so this MLM
//will assume that the calling item was selected and act on it further down in the logic.
singleonlyselected := true where call_itemselected2 = true;
selectedenableditems := true where call_itemenabled2 = false and call_itemselected2 = true;
ctselecteditems := count(singleonlyselected);
ctselectedenableditems := count(selectedenableditems);
if cfgcallsingleonly = "YES" and ctselecteditems > 0 then
callitemselectedyn := true;
elseif ctselectedenableditems > 0 then
callitemselectedyn := true;
endif;
if callitemselectedyn = true or cfgcallitemtype = "FO" then
mlmconfigselecteditems := mlmconfigselecteditems || listfields[z] || "|";
elseif callitemselectedyn = false then
mlmconfigdeselecteditems := mlmconfigdeselecteditems || listfields[z] || "|";
endif;
endif;
enddo;
//This section is the section executed for any "selected" items in the calling field that match the
//MLM logic added to the order set form
if mlmconfigselecteditems[1] <> "" then
//testcallselected := "callingselected";
//break;
(this_communication, this_form) := call call_mlm_logic with (this_communication, this_form,client_info_obj,mlmconfigselecteditems,true,matchconfig, mfon);
endif;
//This section will parse through the MLM configuration for the "deselected items" and verify if there are
//any items that are still "enabled" and "de-selected". If so then the MLM will process the logic for
//how to handle the items in the calling form field based on the fact that the item is deselcted.
deselectedfields := call str_parse with mlmconfigdeselecteditems,"|";
//get the list of items in the MultiOrder field that called the MLM
deselected_itemflds := last of (field_list where field_list.DataItemName = mfname
and field_List.Control_MultiFieldOccNum = (mfon as number));
findconfigitem := "";
cfgcallitemdtl := "";
updatedeselecteditems := "";
for w in (1 seqto count(deselectedfields)) do
//msginfo := "entered forw loop";
//break;
if deselectedfields[w] <> "" then
//msginfo := "entered if deselectedfields[w] logic";
//break;
findconfigitem:= call str_parse with deselectedfields[w],"_";
cfgcallitemdtl := call str_parse with findconfigitem[1],"^";
//set these variables equal to the specific item/segment of the configuration
if ((cfgcallitemdtl[1] = matchconfig) and ((cfgcallitemdtl[2] = mfon) or ((cfgcallitemdtl[2] as number) = (mfon as number)))) then
cfgupdateitemdtl := call str_parse with findconfigitem[2],"^";
cfgcallitemtype := cfgcallitemdtl[1];
cfgcallitemnum := cfgcallitemdtl[2];
cfgcallorders := call str_parse with cfgcallitemdtl[3],",";
cfgcallsingleonly := cfgcallitemdtl[4];
else
cfgupdateitemdtl := null;
cfgcallitemtype := null;
cfgcallitemnum := null;
cfgcallorders := null;
cfgcallsingleonly := null;
endif;
if (cfgcallorders[1] <> "") then
deselectedvalues := deselected_itemflds.Value where deselected_itemflds.Value.name is in cfgcallorders;
deselectednames := deselectedvalues.name where deselectedvalues.IsSelected = false and deselectedvalues.IsReadOnly = false;
elseif cfgcallitemtype <> "" and cfgcallitemnum <> "" then
deselectednames := deselected_itemflds.Value where deselected_itemflds.Value.IsSelected = false and deselected_itemflds.Value.IsReadOnly = false;
endif;
if count(deselectednames) > 0 then
updatedeselecteditems := updatedeselecteditems || deselectedfields[w] || "|";
endif;
endif;
enddo;
//if there are items in the calling form filed that are de-selected AND these items
//match the MLM configuration then we will call the process to update the items based on the
//MLM configuration logic and the fact that the item is deselected.
if count(updatedeselecteditems) > 0 and count(deselected_itemlist) > 0 and updatedeselecteditems[1] <> "" then
//testcalldeselected := "call deselected";
//break;
(this_communication, this_form) := call call_mlm_logic with (this_communication, this_form,client_info_obj,updatedeselecteditems,false,matchconfig,mfon);
endif;
endif;
enddo;
;;
evoke: // No evoke statement
;;
logic:
conclude true;
;;
action:
// This MLM returns two parameters, of types communication_type and form_type respectively.
return this_communication, this_form;
;;
end: