maintenance: title: CALLED_RPM_DOM_MLM ;; mlmname: CALLED_RPM_DOM_MLM ;; arden: version 2.5;; version: 6.00;; institution: RPM, Sample Document Called MLM;; author: Rick Mansour with addition from Steve Abel;; specialist: ;; date: 2010-11-03;; validation: testing;; library: purpose: Demonstrate the ability to identify the current Observation in a structured document and instantiate the parameter. ;; explanation: This is your basic starter mlms for all standard document mlms. ;; keywords: RTF, Document Called MLM , list, multi-select ;; knowledge: type: data-driven;; data: (this_documentCommunication, parameter_name,newValue, sugg_txt_value,UpdateType) := argument; /*******************Make Changes To Spelling And Flags In This Section******************/ /* Set to true if a decision.log is needed.*/ log_execution_info := false; /* Create variable for tab*/ // TAB := 9 formatted with "%c" ; /***************************************************************************************/ //*** Variable and Constant Declaration ***// (this_structuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj; (this_parameters) := this_structuredNoteDoc.ParametersList; (this_chartedObservationsList) := this_structuredNoteDoc.ChartedObservationsList; // if the parameter type is a text and the observation already exist the new data may be a // Replace of Append to current valueObj.Value if not exists UpdateType OR UpdateType NOT IN("Append","Replace") then UpdateType := "Replace"; endif; ///////////////////////////////////////////////////////////////////////////////////////////////// //*** Data Structures ***// //The following data structures can be used to create new objects within the MLM itself. //Not all data structures are represented here, only ones that can be created in the MLM. // Parameter Types NUMERICVALUE := "NumericValue"; FREETEXTVALUE := "FreeTextValue"; LISTVALUE := "ListValue"; LISTSETVALUE := "ListSetValue"; DATEVALUE := "DateValue"; IOVALUE := "IOValue" ; GENERICDRIPVALUE := "GenericDripValue" ; DRIPVALUE := "DripValue" ; ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj]; ListValueType := OBJECT [ListGUID,ListItemsList, SuggestedTextValue]; ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected]; DateValueType := OBJECT [Value]; FreeTextValueType := OBJECT [Value]; NumericValueType := OBJECT [Value]; // // This section of code will demonstrate how to write to FreeTextValue, DateValue,NumericValue // and ListValue parameter := FIRST OF (this_Parameters WHERE this_Parameters.Name = parameter_name ); IF EXISTS parameter THEN //*************************************************************************************** // Check for existing object //*************************************************************************************** obs := first of(this_ChartedObservationsList WHERE this_ChartedObservationsList.parameterGUID = parameter.parameterGUID) ; if not exist obs then //Create a new Observation for the list obs := NEW ObservationType; obs.ClientDocumentGUID := this_documentCommunication.DocumentConfigurationObj.ClientDocumentGUID; obs.ParameterGUID := parameter.ParameterGUID; obs.DataType := parameter.DataType; // Based on the parameter.DataType create the ValueObj Type and set the // valueObj.value for (FREETEXTVALUETYPE,DATEVALUETYPE,NUMERICVALUETYPE) // If the DataType is LISTVALUE then creat the valueObj of LISTVALUETYPE // ABD ASSIGN THE paramter.configurationObj.ListGUID if parameter.DataType = FREETEXTVALUE then obs.ValueObj := NEW FreeTextValueType ; elseif parameter.DataType = DATEVALUE then obs.ValueObj := NEW DateValueType ; elseif parameter.DataType = NUMERICVALUE then obs.ValueObj := NEW NumericValueType ; elseif parameter.DataType = LISTVALUE then obs.ValueObj := NEW ListValueType; obs.ValueObj.ListGUID := parameter.ConfigurationObj.ListGUID; endif; // if parameter.DataType = FREETEXTVALUE then // APPEND obs to the ChartedObservationsList this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := (this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList, obs); endif; if parameter.DataType = FREETEXTVALUE AND UpdateType = "Append" then if length of obs.ValueObj.Value > 0 then obs.ValueObj.Value := obs.ValueObj.Value || "\n" || newValue ; else obs.ValueObj.Value := newValue ; endif; elseif parameter.DataType = FREETEXTVALUE AND UpdateType = "Replace" then obs.ValueObj.Value := newValue ; elseif parameter.DataType IN(DATEVALUE,NUMERICVALUE) then if exists newValue then // new code added by Stve Abel from Roswell Park obs.ValueObj.Value := newValue ; else obs.ValueObj := null; endif; // obs.ValueObj.Value := newValue; This was the code before Steve Abel addition elseif parameter.DataType = LISTVALUE then //Populate the ListItemsList in the new observation object (obs) // loop through each item in the parameter.ConfugurationObj.ListItemsList using // "item"and append the item to the newly created object ListValueListItemType // assign the item.listItemGUID to the selectedItem.ListItemGUID, the Item.value // to the selectedItem.Value and set the SelectedItem.IsSelected := true listItems := (); FOR item IN parameter.ConfigurationObj.ListItemsList DO IF item.Value IN newValue THEN //Create a list item object for the selected list item selectedItem := NEW ListValueListItemType; selectedItem.ListItemGUID := item.ListItemGUID; selectedItem.Value := item.Value; selectedItem.IsSelected := true; // Arden list append statement appending the new object to the listItems // object of the ListValueListItemType Object listItems := (listItems, selectedItem); ENDIF; // set the obs.valueObj.ListItemsList := listItems list object Obs.ValueObj.ListItemsList := listItems; if exists sugg_txt_value then obs.ValueObj.SuggestedTextValue := sugg_txt_value ; endif ; ENDDO; endif; //if parameter.DataType = LISTVALUE then ENDIF; //IF EXISTS parameter THEN ///////////////////////////////////////////////////////////////////////////////////////////////// ;; evoke: ;; logic: conclude true; ;; action: return this_documentCommunication; ;; Urgency: 50;; end: