Exemple #1
0
        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);
        }
Exemple #2
0
        //for selection or presentation with grouping id in from pxs
        public PXSqlGrouping(GroupingRow groupingRow, PXSqlMeta_21 meta, PXSqlVariableClassification var, StringCollection outputCodes)
        {
            Init(groupingRow, meta, var);
            StringCollection tempParentList = new StringCollection();

            mGroups = new List <PXSqlGroup>();
            PXSqlGroup tmpGroup = null;

            foreach (string code in outputCodes)
            {
                tmpGroup = new PXSqlGroup(code);
                mGroups.Add(tmpGroup);
            }

            foreach (PXSqlGroup group in mGroups)
            {
                List <VSGroupRow> tempList = meta.MetaQuery.GetVSGroupRow(mValuePoolId, mValuesetIds, mGroupingId, group.ParentCode);
                if (tempList.Count > 0)
                {
                    foreach (VSGroupRow row in tempList)
                    {
                        group.AddChildCode(row.ValueCode);
                    }
                }
                else
                {
                    group.AddChildCode(group.ParentCode);
                }
            }
            // Add the values to valuecollection of this variable
            AddValues(mValuePoolId, outputCodes, valuePoolValueTextExists);
        }
Exemple #3
0
        //for Selection without grouping id in from pxs
        public PXSqlGrouping(GroupingRow groupingRow, PXSqlMeta_21 meta, PXSqlVariableClassification var, GroupingIncludesType include)
        {
            Init(groupingRow, meta, var);
            //TODO overriding include from paxiom, have to discuss how paxion can override database default.
            this.mIncludeType = include;
            // DONE, is now passed to paxiom as part of GroupingInfo ...  this.mIncludeType = this.mDefaultIncludeType;
            //TODO end
            StringCollection tempParentList = new StringCollection();

            mGroups = new List <PXSqlGroup>();
            PXSqlGroup tmpGroup = null;

            foreach (VSGroupRow myRow in meta.MetaQuery.GetVSGroupRowsSorted(mValuePoolId, mValuesetIds, mGroupingId, meta.MainLanguageCode))
            {
                if (!tempParentList.Contains(myRow.GroupCode))
                {
                    tmpGroup = new PXSqlGroup(myRow.GroupCode);
                    mGroups.Add(tmpGroup);
                    tempParentList.Add(myRow.GroupCode);
                }
                else
                {
                    foreach (PXSqlGroup group in mGroups)
                    {
                        if (group.ParentCode == myRow.GroupCode)
                        {
                            tmpGroup = group;
                            break;
                        }
                    }
                }
                tmpGroup.AddChildCode(myRow.ValueCode);
            }

            // Add the values to valuecollection of this variable
            AddValues(mValuePoolId, tempParentList, valuePoolValueTextExists);

            //PXSqlValue tempValue;
            //    foreach (ValueRow row in meta.MetaQuery.GetValueRowsByValuePool(mValuePoolId, tempParentList, valuePoolValueTextExists))
            //{
            //    tempValue = new PXSqlValue(row, meta.LanguageCodes, meta.MainLanguageCode);
            //    var.Values.Add(tempValue.ValueCode,tempValue);
            //}
        }