maintenance: title: OBJECT_DIPA MLM ;; mlmname: UTIL_OBJECT_DIPA_MLM;; arden: version 2;; version: 5.00;; institution: Eclipsys Corporation;; author: Mohammed Mansoor;; specialist: ;; date: 2006-10-17;; validation: testing;; library: purpose: To create an generic object based on the parameters passed and define , initialize , populate and ADD it. ;; explanation: This is a Generic MLM which can use to set value to any parameter on any type of document both Flowsheet and StructureNote. ;; keywords: ;; knowledge: type: data-driven;; data: //Input parameters ( this_DocumentCommunication , // Document Communication Object Parameter_Name , // Parameter for which the value needs to be set or assign Value) // Value to be assigned. //Clear_Field) // Are we clearing the field? YES/NO.default "NO" , Specifically for Datevaluetype := ARGUMENT; //Get The Structure Note (this_Doc) := this_documentCommunication.DocumentConfigurationObj; //Get the Parameter List (this_parms) := This_Doc.ParametersList; //Get the Observation (this_observations) := This_Doc.ChartedObservationsList; //Checking for the documnet type IF this_DocumentCommunication.DocumentType = "Flowsheet" THEN IsFlowsheet := TRUE; IsStructNote := FALSE; ELSEIF this_DocumentCommunication.DocumentType = "StructureNote" THEN IsFlowsheet := FALSE; IsStructNote := TRUE; ENDIF; /**************************************************************** Defining the all object types ****************************************************************/ //Declare the Observation ObservationType := OBJECT [ ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj ]; //Declare the NumericValue NumericValueType := OBJECT [ Value ]; //Declare the TextValue TextValueType := OBJECT [ Value ]; //Declare the DateValue DateValueType := OBJECT [ Value ]; //Decalare the ListValue ListValueType :=OBJECT [ ListGUID, ListItemsList, SuggestedTextValue ]; //Declare the ListItem ListItemType := OBJECT[ListItemGuid, Value, IsSelected]; //FOLLOWING OBJECTS ARE ONLY FOR FLOWSHEET DOCUMENTS. IF IsFlowsheet = TRUE THEN //Declare the Listset Value ListSetValueType := OBJECT [ ListValuesList ]; //Declare the IO Value IOValueType := OBJECT [ InValue, OutValue, DayRunningValue, BagNumber, BagInitialVolume ]; //Declare the Generic Drip Value GenericDripValueType := OBJECT [DoseValue, RateValue ]; //Declare the Drip Value DripValueType := OBJECT [ Value, BagNumber, BagInitialVolume ]; ENDIF; ;; evoke: /* Call MLM */ ;; logic: /************************************************************************* Creating object of the observation. *************************************************************************/ Result_observation := NEW ObservationType; Result_observation.ClientDocumentGUID := This_Doc.ClientDocumentGUID; Result_observation.ParameterGUID := Last(Parameter_Name.ParameterGUID); Result_observation.DataType := Parameter_Name.DataType; //Checking for the datatype of the parameter. /************************************************************************* Initializing and Populating with Value *************************************************************************/ //NUMERIC VALUE IF Parameter_Name.DataType = "NUMERICVALUE" THEN //CHECKING FOR THE RESULT VALUE EXIST IF value IS NOT NULL THEN //creates the new NumericValueType object and populates the fields // - this is the value being supplied to the observation Result_observation.ValueObj := NEW NumericValueType; Result_observation.ValueObj.Value := value AS NUMBER; ENDIF; //TEXT VALUE ELSEIF Parameter_Name.DataType = "FreeTextValue" THEN //creates the new NumericValueType object and populates the fields // - this is the value being supplied to the observation Result_observation.ValueObj := NEW TextValueType; Result_observation.ValueObj.Value := value AS STRING; //DATE VALUE ELSEIF Parameter_Name.DataType = "DATEVALUE" THEN //creates the new NumericValueType object and populates the fields // - this is the value being supplied to the observation //We are setting the value object only when Clear field flag is No or NULL. If Value IS NOT NULL OR Value <> "" Then Result_observation.ValueObj := NEW DateValueType; Endif; Result_observation.ValueObj.Value := value; //LIST VALUE ELSEIF Parameter_Name.DataType = "LISTVALUE" THEN //Get the Parameter details (This_List_param) := this_parms WHERE this_parms.NAME = (Parameter_Name.name as string); //Get the LitConfiguration of the parameter (this_List_Config_list) := This_List_param.ConfigurationObj; //Get the ListItemConfiguration (this_List_ListItem) := LAST(this_List_Config_list.Listitemslist); //Create ValueObj as the ListValue Result_observation.ValueObj := NEW ListValueType; //Populate the ValueObj ListGUID from the ListGUID of the ListConfiguration Result_observation.ValueObj.ListGUID := LAST(this_List_Config_list.ListGUID); //List item array declaration. listItems := (); //Creating the ListItem NewListItem := NEW ListItemType; //Populating the ListItem Item := FIRST OF(this_List_ListItem WHERE (this_List_ListItem.value = Value)); NewListItem.ListItemGUID := item.ListItemGUID; NewListItem.Value := item.Value; NewListItem.IsSelected := TRUE; //Adding ListItem in the List listItems := listItems, NewListItem; //Attaching the ListItem to the ListValue of the created observation Result_observation.ValueObj.ListItemsList := listItems AS LIST; ENDIF ; /************************************************************************* Add the new value to the document{{{SINGLE-QUOTE}}}s charted observations *************************************************************************/ //Structure Note If IsFlowsheet = FALSE AND IsStructNote = TRUE Then This_Doc.ChartedObservationsList :=(This_Doc.ChartedObservationsList, Result_observation); //Flowsheet. ElseIf IsFlowsheet = TRUE AND IsStructNote = FALSE Then This_Doc.CurrentColumn.ChartedObservationsList := ( This_Doc.CurrentColumn.ChartedObservationsList, Result_observation ); EndIf; //Conclude true CONCLUDE TRUE; ;; action: RETURN Result_observation ; ;; Urgency: 50;; end: