maintenance: title: Selected/de-select chaars & item supply orders on Order Sets;; mlmname: FORM_Set_FBC_Charges;; arden: version 2;; version: 5.50;; institution: St Clair FBC;; author: Maria Pest, Allscripts ext 7443;; specialist: Shawn Head, Allscripts ext 7468;; date: 2012-03-16;; validation: testing;; library: purpose: Used to auto select/de-select charges and/or Item supply orders when the opposite is checked/unchecked. used on the FBC Charges (mother) order set ;; explanation: This MLM is called from the FBC Charges (Mother) Order set Change history 03.15.2012 STH Copied FORM_Set_Labs_Deselected to create this MLM as a net-new MLM on 3.15.2012 ;; keywords: Called MLMs, FBC, FBC charges, FBC charges (mother) ;; 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 ONLY******************************************************/ /* Set to true if a decision.log is needed.*/ log_execution_info := FALSE; //identifies the SCM form item that will need to trigger the MLM. e.g. items using MultiOrderCheckBox(3) will be MultiOrderCheckBox|3 //callingformitem[1] (in this MLM its MultiOrderCheckBox|3) will match up to items listed in itemsgrp1 //callingformitem[2] (in this MLM its MultiOrderCheckBox|4) will match up with itemsgrp2 callingformitem := ("MultiOrderCheckBox|3","MultiOrderCheckBox|4"); //DO NOT add more than 2 MultiOrder items in this section as this will cause unexpected results. //if an item from itemsgrp1 is selected it will auto select/deselect the item associated with the cooresponding item in itemsgrp2. //e.g. if Chg 0015 Straight Catheter Insertion is selected/deselected then Chg 4000 Straight Cath Urine 15Fr will be selected/deselected automatically itemsgrp1 := ("Chg 4000 Straight Cath Urine 15Fr" //item1 ,"Chg 4001 Indwelling Cath Urine 16Fr"); //item2 //,""); //item4 //,""); //item5 //,""); //item6 //,""); //item7 //,""); //item8 //,""); //item9 //,""); //item10 itemsgrp2 := ("Chg 0015 Straight Catheter Insertion" //item1 ,"Chg 0026 Foley Insertion"); //item2 //,""); //item4 //,""); //item5 //,""); //item6 //,""); //item7 //,""); //item8 //,""); //item9 //,""); //item10 /**********************END of Make Changes To Spelling And Flags In This Section ONLY*******************************************/ // Initialize error message error_message:=""; /*****************************below is all the code pulled from FORM_Set_Labs_Deselected******************/ // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; //define item lists that will be used in this MLM Grid_itemlist := (); Grid_itemcheck := (); update_itemlist := (); update_itemcheck := (); //Get the multi order grid check box value //check to make sure the calling item from the form is configured to trigger this MLM if CallingField is in callingformitem then //identify the "Control_MultiFieldOccNum" associated with the multiorder grid calling the MLM. e.g (MultiOrderGrid(3) will return 3 in mfon callfieldlgth := length of CallingField; findpipe := FIND "|" IN STRING CallingField; itemctlenght := callfieldlgth - findpipe; itemstartpos := findpipe + 1; mfon := substring itemctlenght characters starting at itemstartpos from CallingField; //get the list of items in the MultiOrder field that called the MLM Grid_itemflds := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = (mfon as number)); Grid_itemlist := Grid_itemflds.Value; Grid_itemcheck := Grid_itemlist.IsSelected; //identify the "Control_MultiFieldOccNum" associated with the multiorder grid needing updated. e.g. (MultiOrderGrid(4) will return 4 in mfonupdate updateitemname := last of (callingformitem where callingformitem <> CallingField); updatefieldlgth := length of updateitemname; updatepipe := find "|" in string updateitemname; updatectlength := updatefieldlgth - updatepipe; updatestartpos := updatepipe + 1; mfonupdate := substring updatectlength characters starting at updatestartpos from updateitemname; //get the list of items in the MultiOrder field that will need updated based on item selection update_itemflds := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_list.Control_MultiFieldOccNum = (mfonupdate as number)); update_itemlist := update_itemflds.Value; update_itemcheck := update_itemflds.IsSelected; //set the callingitems and udpateitems equal to the proper itemsgrp defined in the edit sections based on the calling field. //Currently this MLM is only configured to handle 2 objects a calling field and an update field which is why you will find a note //in the edit section that states "DO NOT add more than 2 MultiOrder items in this section as this will cause unexpected results." if CallingField = callingformitem[1] then callingitems := itemsgrp1; updateitems := itemsgrp2; else callingitems := itemsgrp2; updateitems := itemsgrp1; endif; //big old for loop. Basically looping through all items in the calling field (MultiOrderCheckBox in this MLM) //this for loop will check the each item in the calling field against the items configured in edit sections to verify //if the item(s) selected in the calling field need to update a field in the update field section. If it finds that //an item in the calling event is configured in the edit section to "trigger" an update to the update field section //then the MLM will "update" the update item that cooresponds to the calling item name(s) to match the "IsSelected" value //of the calling item. In sort. If you check callingitems[1] this MLM will check updateitems[1], if you check callingitems[2] //this MLM will check updateitem[2]. If you uncheck callingitems[1] updateimtes[1] will uncheck, ect... for j in 1 seqto (count Grid_itemlist) do if Grid_itemlist[j].name is in callingitems then for x in 1 seqto (count callingitems) do if callingitems[x] = Grid_itemlist[j].name then callitemnum := x; endif; enddo; for x in 1 seqto (count update_itemlist) do if update_itemlist[x].name = updateitems[callitemnum] then isitemcheck := Grid_itemcheck[j]; update_itemlist[x].IsSelected := isitemcheck; endif; enddo; endif; enddo; endif; /**************************************end of original code pulled from FORM_Set_Labs_Deselected************************/ ;; 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: