Fix access of multi-return RO values if group definition is not in order in RO Editor

This commit is contained in:
Kathy Ruffing 2013-12-13 15:28:36 +00:00
parent fb55534ed8
commit e3c0de2793

View File

@ -84,6 +84,7 @@ namespace VEPROMS.CSLA.Library
#region Local Data
private string _ROValue = "";
private List<string> lstRoValues;
private List<string> multiRoValues;
private Dictionary<string, string> DictROVar = new Dictionary<string, string>();
#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<string> GetROReturnValue(string roval)
{
lstRoValues = new List<string>();
multiRoValues = new List<string>();
DictROVar = new Dictionary<string, string>(); // 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);
}
}