diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 06956b84..093f1e83 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -1340,14 +1340,40 @@ i = 0; // prevLPI = curLPI; // } //} - MatchCollection matches = regexFindToken.Matches(pageItem.Token); + // C2019-006 - Moved and modified the RO_Lookup() logic here, before we process the tokens in the page list + // this allows us to use RO_Lookup() in a "PS=" conditional token (is usually a PSI check box) + // A while loop was also added to the we can have more than one call to RO_Lookup() on a pagelist line + // this logic was put in for Barakah Alarms + // Note that each Alarm is defined as its own RO in the Referenced Object database, with multiple return values + // to define the Window ID, Alarm, Source, Setpoint, etc. for example. + string pltok = pageItem.Token; + while (pltok.Contains("RO_Lookup(")) + { + int idxstart = pltok.IndexOf("RO_Lookup("); + int idxend = pltok.Substring(idxstart).IndexOf(")"); + string ROLookupstr = pltok.Substring(idxstart, idxend + 1); + string parms = ROLookupstr.Substring(10, ROLookupstr.Length - 11); + MatchCollection sm = regexFindToken.Matches(parms); + foreach (Match m in sm) // resolve pagelist tokens that are parameters for ROLookup() + { + string tnk = m.Value; + ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref parms, tnk); + } + string[] parts = parms.Split(",".ToCharArray()); + // parts[0] - the RO to look up - for Alarms, is usually the EOP number thus uses the "{EOPNUM}" token + // parts[1] - Which of the multiple return value from the RO to return + // parts[2] - the value to use if not found in ROs - usually defined in a PSI field for that Alarm procedure + string ROLookupVal = ROLookup(parts[0], parts[1], parts[2]); + pltok = pltok.Substring(0, idxstart) + ROLookupVal + ((idxstart + idxend < pltok.Length) ? pltok.Substring(idxstart + idxend + 1) : ""); + } + MatchCollection matches = regexFindToken.Matches(pltok);//(pageItem.Token); if (matches.Count > 0) { - string plstr = ""; + string plstr = ""; // When a pagelist line (row) has more than one token that is resolved to text, each resolved token text was place on top // of each other. Use a temporary string (plstr) to process the pagelist tokens for each pagelist line (row) before adding // it to the svgGroup. - plstr = pageItem.Token; + plstr = pltok;//pageItem.Token; // F2017-046: Remove the '@@' characters that were getting printed on SAMG Sup Info facing pages for Calvert (BGESAM1 format). if (MyPromsPrinter.DoingFacingPage && plstr.Contains("@@")) plstr = plstr.Replace("@@", ""); foreach (Match match in matches) @@ -1379,7 +1405,8 @@ i = 0; string relval = procConfig.GetValue("PSI", reltoken); if (relval == "Y") { - svgGroup.Add(PageItemToSvgText(pageItem.Token, (float)pageItem.RelatedItem.Row, (float)pageItem.RelatedItem.Col, pageItem.RelatedItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft, pageItem.Font, val, MySection)); + //svgGroup.Add(PageItemToSvgText(pageItem.Token, (float)pageItem.RelatedItem.Row, (float)pageItem.RelatedItem.Col, pageItem.RelatedItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft, pageItem.Font, val, MySection)); + svgGroup.Add(PageItemToSvgText(pltok, (float)pageItem.RelatedItem.Row, (float)pageItem.RelatedItem.Col, pageItem.RelatedItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft, pageItem.Font, val, MySection)); plstr = ""; // Clear it so it isn't put out twice (used below) } } @@ -1414,12 +1441,6 @@ i = 0; if (!ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, token)) break; } } // end foreach matches - if (plstr.StartsWith("RO_Lookup(")) - { - string parms = plstr.Substring(10,plstr.Length-11); - string[] parts = parms.Split(",".ToCharArray()); - plstr = ROLookup(parts[0], parts[1], parts[2]); - } if (plstr != "") { if (useFontForCheckOffHeader != null) @@ -1429,7 +1450,7 @@ i = 0; } } else - svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token, MySection)); + svgGroup.Add(PageItemToSvgText(pageItem, pltok, MySection)); } } // Proms page numbering designed requires a "{PAGE}" token to increment the page counter. So the easiest way @@ -1460,7 +1481,7 @@ i = 0; accpgid = accpgid.Replace(@"\u8209?", "-"); val = myLookup.GetROValueByAccPagID("<" + accpgid + "." + multiid + ">", MySection.MyDocVersion.DocVersionConfig.RODefaults_setpointprefix, MySection.MyDocVersion.DocVersionConfig.RODefaults_graphicsprefix); } - if (!deflt.StartsWith("[") && val != null) + if (!deflt.StartsWith("[") && val != null && val.Trim().Length > 0) // don't return val if it's an empty or blank string - jsj 01-28-2019 { val = val.Replace("[xB3]", "\xB3"); val = val.Replace("[xB2]", "\xB2");