maintenance: title: Change Supplement Form Per Frequency Changes;; mlmname: FORM_Diet_Supplement_Freq;; arden: version 2;; version: 4.50;; institution: St Clair Diet MLM;; author: Robert Spence, Eclipsys Corp;; specialist: ;; date: 2006-03-31;; validation: testing;; library: purpose: This MLM sets the field PRN Reason text to visible and mandatory if IsPRN true. ;; explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and Communications objects and compares it to Client Information to determine whether to display certain fields and make them mandatory. A Banner message is presented to the user to remind them that these fields must be completed. If the patient data does not meet the above conditions the fields are not visible on the form. The MLM is not run from a trigger event, but rather is called by the application. It should be configured to run on Form Open. ;; keywords: Called MLMs, Form fields, PRN, PRN Reason text ;; 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; /***************************************************************************************/ // Initialize error message error_message:=""; // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; CallingField :=this_communication.CallingFieldName; CallingEvent :=this_communication.CallingEvent; // This sets the visible control on the field dataitem - FrequencyCode UDFreq_field := first of (field_list where field_list.DataItemName = "DIET_Supplement Frequency" ); Freq_field := first of (field_list where field_list.DataItemName = "FrequencyCode" ); Freq_value := freq_field.value; Freq_summary := freq_value.frequencysummary; //In_Frequency_field := first of (field_list //where field_list.DataItemName = "FrequencyCode" ); Breakfast_field := first of (field_list where field_list.DataItemName = "DIET_SSP_LO_1_Breakfast" ); MidMorning_field := first of (field_list where field_list.DataItemName = "DIET_SSP_LO_2_Mid Morning" ); Lunch_field := first of (field_list where field_list.DataItemName = "DIET_SSP_LO_3_Lunch" ); MidAfternoon_field := first of (field_list where field_list.DataItemName = "DIET_SSP_LO_4_Mid Afternoon" ); Dinner_field := first of (field_list where field_list.DataItemName = "DIET_SSP_LO_5_Dinner" ); BeforeBed_field := last of (field_list where field_list.DataItemName = "DIET_SSP_LO_6_Before Bed" ); /*If exists(In_Frequency_field) then Freq:=In_Frequency_field.value.frequencysummary; endif; this_communication.DisplayForm := "Yes"; this_communication.Message := "Freq defined as: "|| Freq_summary || "\n" || "Calling field is : " || CallingField; this_communication.MessageType := "Error";*/ If CallingEvent="FieldChange" then If ((CallingField="FrequencyCode") or (CallingField="DIET_Supplement Frequency")) then If Freq_summary = "Daily" OR UDFreq_field.value = "Daily" then Breakfast_field.Value :=FALSE; MidMorning_field.Value :=FALSE; Lunch_field.Value :=TRUE; MidAfternoon_field.Value :=FALSE; Dinner_field.Value :=FALSE; BeforeBed_field.Value :=FALSE; elseif (Freq_summary = "BID" OR UDFreq_field.value = "BID") then Breakfast_field.Value :=FALSE; MidMorning_field.Value :=FALSE; Lunch_field.Value :=TRUE; MidAfternoon_field.Value :=FALSE; Dinner_field.Value :=TRUE; BeforeBed_field.Value :=FALSE; elseif (Freq_summary = "TID" OR UDFreq_field.value = "TID") then Breakfast_field.Value :=TRUE; MidMorning_field.Value :=FALSE; Lunch_field.Value :=TRUE; MidAfternoon_field.Value :=FALSE; Dinner_field.Value :=TRUE; BeforeBed_field.Value :=FALSE; elseif (Freq_summary = "QID" OR UDFreq_field.value = "QID") then Breakfast_field.Value :=TRUE; MidMorning_field.Value :=FALSE; Lunch_field.Value :=TRUE; MidAfternoon_field.Value :=FALSE; Dinner_field.Value :=TRUE; BeforeBed_field.Value :=TRUE; else Breakfast_field.Value :=FALSE; MidMorning_field.Value :=FALSE; Lunch_field.Value :=FALSE; MidAfternoon_field.Value :=FALSE; Dinner_field.Value :=FALSE; BeforeBed_field.Value :=FALSE; endif; ENDIF; ENDIF; ;; 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: