private List <PXSqlGroup> GetListOfGroupFromPxs() { if (this.pxsQueryVariable.Values.Items.Length == 0) { throw new ApplicationException("GetListOfGroupFromPxs(): No entries found"); } List <PXSqlGroup> myOut = new List <PXSqlGroup>(); foreach (PCAxis.Sql.Pxs.ValueTypeWithGroup val in this.pxsQueryVariable.Values.Items) { if (val.code.Contains("*") || val.code.Contains("?")) { throw new ApplicationException("GetListOfGroupFromPxs(): Groups cannot contain wildcards"); } PXSqlGroup group = new PXSqlGroup(val.code); if (val.Group == null || val.Group.GroupValue == null || val.Group.GroupValue.Length < 1) { throw new ApplicationException("GetListOfGroupFromPxs(): Expected group children"); } foreach (GroupValueType child in val.Group.GroupValue) { group.AddChildCode(child.code); } myOut.Add(group); } return(myOut); }
/// <summary> /// Recursive method drilling down to the leafs /// </summary> /// <param name="toGroup">Add the leaf IDs to this</param> /// <param name="parentCode">Check if this has children</param> private void addLeafChildIds(PXSqlGroup toGroup, String parentCode) { Dictionary <string, ValueGroupRow> templist = meta.MetaQuery.GetValueGroupRowskeyValueCode(mGroupingId, parentCode, true); if (templist.Count < 1) { //Has no children toGroup.AddChildCode(parentCode); } else { foreach (KeyValuePair <string, ValueGroupRow> childOfparent in templist) { addLeafChildIds(toGroup, childOfparent.Key); } } }