diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index 4eb4ead5..e222959a 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -346,10 +346,11 @@ namespace Volian.Controls.Library ch = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag; chld = ch.children; // build a list of ROs to search - return _MyRODbID.ToString() + ":" + GetROsToSearch(chld); - //return _MyRODbID.ToString() + ":" + ch.roid + "0000," + GetROsToSearch(chld); - //if (strRtnStr.EndsWith(",")) - // strRtnStr = strRtnStr.Substring(0, strRtnStr.Length - 1); + // B2022-118: remove the ending comma otherwise query will fail + string strRtnStr = _MyRODbID.ToString() + ":" + GetROsToSearch(chld); + if (strRtnStr.EndsWith(",")) + strRtnStr = strRtnStr.Substring(0, strRtnStr.Length - 1); + return strRtnStr; } } } @@ -1939,6 +1940,13 @@ namespace Volian.Controls.Library private string GetROsToSearch(ROFSTLookup.rochild[] chld) { string rtnstr = string.Empty; + // B2022-118: If the ro has child nodes in tree view but they aren't loaded, load them + if ((chld == null || chld.Length <= 0) && (cmboTreeROs.SelectedNode.Nodes != null || cmboTreeROs.SelectedNode.Nodes.Count >= 1)) + { + ROFSTLookup.rochild ro = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag; + MyROFSTLookup.LoadChildren(ref ro); + chld = ro.children; + } // B2022-026 RO Memory Reduction code - check children length if (chld == null || chld.Length <= 0) // get a single ROID @@ -1956,7 +1964,17 @@ namespace Volian.Controls.Library if (roc.children != null && roc.children.Length > 0) rtnstr += GetROsToSearch(roc.children); else - rtnstr += ROFSTLookup.FormatRoidKey(roc.roid, false); + { + // B2022-118: If the ro has child nodes in tree view but they aren't loaded, load them + ROFSTLookup.rochild rot = roc; + MyROFSTLookup.LoadChildren(ref rot); + chld = rot.children; + + if (rot.children != null && rot.children.Length > 0) + rtnstr += GetROsToSearch(rot.children); + else + rtnstr += string.Format("{0},", ROFSTLookup.FormatRoidKey(roc.roid, false)); + } } }