From e3c0de2793e7c101b3dbc4ccec43dbc5ab2e40c4 Mon Sep 17 00:00:00 2001 From: Kathy Date: Fri, 13 Dec 2013 15:28:36 +0000 Subject: [PATCH] Fix access of multi-return RO values if group definition is not in order in RO Editor --- .../Config/ROFSTLookup.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs b/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs index 21c0711e..65ae358a 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs @@ -84,6 +84,7 @@ namespace VEPROMS.CSLA.Library #region Local Data private string _ROValue = ""; private List lstRoValues; + private List multiRoValues; private Dictionary DictROVar = new Dictionary(); #endregion #region Constructors @@ -691,8 +692,9 @@ namespace VEPROMS.CSLA.Library myGrp.children = new rochild[lstROVals.Count]; for (int i = 0; i < lstROVals.Count; i++) { + string tsts = Convert.ToInt32(multiRoValues[i][0]).ToString("X4"); myGrp.children[i].value = lstROVals[i]; - myGrp.children[i].roid = TableID.ToString("X4") + myGrp.ID.ToString("X8") + (0x41+i).ToString("X4"); + myGrp.children[i].roid = TableID.ToString("X4") + myGrp.ID.ToString("X8") + tsts; myGrp.children[i].type = -1; // Multiple return value inherit type from parent myGrp.children[i].title = lstROVals[i]; } @@ -763,9 +765,10 @@ namespace VEPROMS.CSLA.Library public List GetROReturnValue(string roval) { lstRoValues = new List(); + multiRoValues = new List(); DictROVar = new Dictionary(); // set up a dictionary of RO defined Variables string tmp = ProcessRO(_DocVersionInfo==null?roval:_DocVersionInfo.ProcessDocVersionSpecificInfo(roval), false); - if (lstRoValues.Count == 0) // was not a multiple return value + if (tmp != null && lstRoValues.Count == 0) // was not a multiple return value lstRoValues.Add(tmp); return lstRoValues; } @@ -799,6 +802,7 @@ namespace VEPROMS.CSLA.Library cnt = ptr; //(int)(ptr - str); bool nfnd = false; string pbstr = ProcessBrace(str.Substring(1, cnt - 2), cnt - 2, ref nfnd, multiRtnVal); + if (pbstr == null) return null; if (nfnd) rtnstr += str.Substring(0, cnt); // add(new seText(str, cnt)); @@ -916,7 +920,13 @@ namespace VEPROMS.CSLA.Library // 'l' is the lenght up to the matching brace of the variable definition string tmpval = ProcessRO(str.Substring(nxt + 1, l - nxt - 1), multiRtnVal); if (tmpval.Equals(string.Empty)) tmpval = " "; // nothing assinged to variable - DictROVar.Add(str.Substring(0, nxt), tmpval); + if (!DictROVar.ContainsKey(str.Substring(0, nxt))) // need a try/catch here. + { + DictROVar.Add(str.Substring(0, nxt), tmpval); + multiRoValues.Add(str.Substring(0, nxt)); + } + else + return null; if (multiRtnVal) rtnstr = tmpval; } @@ -1036,7 +1046,8 @@ namespace VEPROMS.CSLA.Library while (tstr.Length > 0) { int idx = MatchingBrace(tstr); - lstRoValues.Add(ProcessRO(tstr.Substring(0, idx + 1), true)); + string tmpVal = ProcessRO(tstr.Substring(0, idx + 1), true); + if (tmpVal != null) lstRoValues.Add(tmpVal); // duplicates get returned as null tstr = tstr.Substring(idx + 1); } }