private void GetResultFromDataTable() { object result = null; if (this.Context.Recodes.ContainsKey(this.Id)) { Epi.Core.AnalysisInterpreter.Rules.RecodeList RL = this.Context.Recodes[this.Id]; result = RL.GetRecode(this.Context.CurrentDataRow[RL.SourceName]); } else { result = ParseDataStrings(this.Context.CurrentDataRow[this.Id].ToString()); } if (result is System.DBNull) { result = null; } ReturnResult = result; }
/// <summary> /// performs execution of retrieving the value of a variable or expression /// </summary> /// <returns>object</returns> public override object Execute() { object result = null; if (this.Id != null) { IVariable var; DataType dataType = DataType.Unknown; string dataValue = string.Empty; if (this.Context.MemoryRegion.TryGetVariable(this.Id, out var)) { if (var.VarType == VariableType.Standard || var.VarType == VariableType.DataSource) { if (this.Context.CurrentDataRow != null) { if (var.VarType == VariableType.Standard) { if (this.Context.Recodes.ContainsKey(var.Name)) { Epi.Core.AnalysisInterpreter.Rules.RecodeList RL = this.Context.Recodes[var.Name]; result = RL.GetRecode(this.Context.CurrentDataRow[RL.SourceName]); } else { //result = ParseDataStrings(this.Context.CurrentDataRow[this.Id].ToString()); result = this.Context.CurrentDataRow[this.Id]; } } else { //result = ParseDataStrings(this.Context.CurrentDataRow[this.Id].ToString()); result = this.Context.CurrentDataRow[this.Id]; } if (result is System.DBNull) { result = ""; } } else // there is NO current row go through datarows { this.Context.GetOutput(GetResultFromDataTable); result = ReturnResult; } } else { dataType = var.DataType; dataValue = var.Expression; result = ConvertEpiDataTypeToSystemObject(dataType, dataValue); } } else if (this.Context.CurrentDataRow != null) { if (this.Context.Recodes.ContainsKey(this.Id)) { Epi.Core.AnalysisInterpreter.Rules.RecodeList RL = this.Context.Recodes[this.Id]; result = RL.GetRecode(this.Context.CurrentDataRow[RL.SourceName]); } else { result = this.Context.CurrentDataRow[this.Id]; if (result is System.DBNull) { result = null; } } } } else { if (value is AnalysisRule) { result = ((AnalysisRule)value).Execute(); } else { result = value; } } return result; }