maintenance: title: Make read only fields available;; mlmname: FORM_GENERIC_un_gray;; arden: version 2;; version: 4.50;; institution: St Clair Hospital;; author: Mary Sieger, Mary.Sieger@stclair.org, 412-942-1194;; specialist: Eclipsys Corporation;; date: 2006-10-26;; validation: testing;; library: purpose: Based on a value provided in one field, make another field AVAILABLE. ;; explanation: This generic MLM can be called from several order forms: - LAB Chem Blood Gas - (others?) If a particular value is placed in a certain field of a certain form, specified by the configuration list below, then another field, also in the list, will be made to be available (i.e. un-grayed). Trigger on formopen or fieldchange. Rules: Use lists of forms, fields to test on the form, values to test for, field to make available (if the value in the other field is present) change history 2.11.2007 DJW added a new form, LAB ChemBloodGas_Tmp. 5.29.2015 MJP CSR#33459 added new fields for High Flow ;; keywords: Called MLMs, Form fields, generic, field test, read-only ;; knowledge: type: data-driven;; data: /***********************Make Changes To Spelling And Flags In This Section************************/ //NOTE: THE RELATIVE ORDER OF ITEMS MUST BE MAINTAINED WITHIN LISTS!!! //MUST HAVE THE FOLLOWING ORDER FOR EACH ELEMENT ITEM: //"FORM_NAME|FIELD_NAME_TO_TEST|VALUEs_TO_TEST_FOR|FIELD_TO_MAKE_NOT_READ_ONLY" form_map_list := ("LAB Chem Blood Gas|LAB_RC_BGCMT_RespAerosolMode|(any_value)|LAB_RC_BGCMT_LV_RespAerosolConc" ,"LAB Chem Blood Gas|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_RespMode_BIPAP_CPAP" ,"LAB Chem Blood Gas|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespIPAPcmH2O" ,"LAB Chem Blood Gas|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespEPAPcmH2O" ,"LAB Chem Blood Gas|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespBIPAPCPAPO2" ,"LAB Chem Blood Gas|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespBIPAPCPAPLPM" ,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_VT" ,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_O2ConcFIO2" ,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_PEEP" ,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_PressureSupport" ,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_Rate" ,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_HiFloNCLPM|(any_value)|LAB_RC_BGCMT_LV_HiFloNC%" ,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_RespAerosolMode|(any_value)|LAB_RC_BGCMT_LV_RespAerosolConc" ,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_RespMode_BIPAP_CPAP" ,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespIPAPcmH2O" ,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespEPAPcmH2O" ,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespBIPAPCPAPO2" ,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespBIPAPCPAPLPM" ,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_VT" ,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_O2ConcFIO2" ,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_PEEP" ,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_PressureSupport" ,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_Rate" ,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_HiFloNCLPM|(any_value)|LAB_RC_BGCMT_LV_HiFloNC%" ,"YOUR_FORM_NAME_HERE|YOUR_TEST_FIELD_HERE|VALID_VAL1,VALID_VAL2|UN_GRAY_FIELD_HERE" ); /**************************************************************************************JAB********/ // 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; //Initialize MLM pointers: str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; chk_overdue_time := MLM {{{SINGLE-QUOTE}}}overdue_req_time{{{SINGLE-QUOTE}}}; // Initialize error message error_message:=""; // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; CallingForm := this_form.name; CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; if called_by_editor then CallingForm := "LAB Chem Blood Gas"; CallingEvent := "FieldChange"; CallingField := "LAB_RC_BGCMT_RespAerosolMode"; endif; for i in 1 seqto count form_map_list do // initialize vars: visible_field := null; trigger_field := null; // parse the form mapper: form_element_list := call str_parse with form_map_list[i], "|"; test_form_name := form_element_list[1]; //Lookup form name from map list // Test for proper form if CallingForm = test_form_name then test_visible_field := form_element_list[4]; //Lookup visible field from map list visible_field := first of (field_list where field_list.DataItemName = test_visible_field); // Set open form defaults if exists visible_field then test_field := form_element_list[2]; //Lookup test field from map list trigger_field := first of (field_list where field_list.DataItemName = test_field); //check for {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} fields if visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then Right_box := last of (field_list where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Right" ); Superficial_box := last of (field_list where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Superficial" ); Left_box := last of (field_list where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Left" ); Deep_box := last of (field_list where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Deep" ); endif; // Test for proper field if exists trigger_field then //Lookup list of valid values for the test field test_val_list := call str_parse with form_element_list[3], ","; //Check for time field if trigger_field.dataitemname = "RequestedTime" and "overdue" is in test_val_list then if exists trigger_field.value.reqtimevalue then time_type := "scheduled"; time_val := trigger_field.value.reqtimevalue; else time_type := "coded"; time_val := trigger_field.value.reqtimecode; endif; // check for overdue time time_is_overdue := call chk_overdue_time with time_val, time_type; endif; if ((trigger_field.value as string) is in test_val_list) or ("(any_value)" is in test_val_list and trigger_field.value is not null) or time_is_overdue then // Make the field UN-GRAYED (but NOT Mandatory!) visible_field.control_read_only := false; // make {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} settings writable if visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then Right_box.control_read_only := False; Superficial_box.control_read_only := False; Left_box.control_read_only := False; Deep_box.control_read_only := False; else Right_box.control_read_only := true; Superficial_box.control_read_only := True; Left_box.control_read_only := True; Deep_box.control_read_only := True; // Right_box.value := null; // Superficial_box.value := null; // Left_box.value := null; // Deep_box.value := null; endif; else visible_field.control_read_only := true; visible_field.value := ""; if visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then Right_box.control_read_only := true; Superficial_box.control_read_only := True; Left_box.control_read_only := True; Deep_box.control_read_only := True; Right_box.value := ""; Superficial_box.value := ""; Left_box.value := ""; Deep_box.value := ""; endif; endif; // (trigger_field.value as string) is in test_val_list /* // FOR DEBUGGING PURPOSES: display a message to the user this_communication.Message := "callingform = "|| callingform || "\nCallingEvent = " || CallingEvent || "\ntest_form_name = " || test_form_name || "\ntest_field = " || test_field || "\ntest_visible_field = " || test_visible_field || "\ntrigger_field = " || trigger_field.dataitemname || "\nvisible_field = " || visible_field.dataitemname || "\ntrigger_field.value = " || trigger_field.value || "\ntest_val_list = " || test_val_list || "\nvisible_field = " || visible_field || "\ntime_is_overdue = " ||time_is_overdue; this_communication.MessageType := "Informational"; */ endif; // exists trigger_field endif; // exists visible_field endif; // CallingForm = test_form_name enddo; // for i in 1 seqto count form_map_list ;; 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: