示例#1
0
        /// <summary>
        ///
        /// </summary>
        ///

        protected void SetElimForSelection()
        {
            string tmpElim;

            this.IsEliminatedByValue = false;

            PXSqlValueSet vs = this.ValueSets[selectedValueset];

            tmpElim = vs.Elimination;

            if (tmpElim.Equals(meta.Config.Codes.EliminationN))
            {
                this.PaxiomElimination = PXConstant.NO;
            }
            else
            {
                this.PaxiomElimination = PXConstant.YES;
            }
        }
示例#2
0
        internal override List <PXSqlValue> GetValuesForParsing()
        {
            if (currentGrouping != null)
            {
                return(currentGrouping.GetValuesForParsing());
            }

            if ((meta.inPresentationModus) && meta.ConstructedFromPxs)
            {
                return(mValues.GetValuesSortedByPxs(mValues.GetValuesForSelectedValueset(selectedValueset)));
                //return GetValuesSortedDefault(GetValuesForSelectedValueset()); // old sorting Thomas say its how Old Pcaxis does
            }
            else
            {
                PXSqlValueSet     tmpValueSet = mValueSets[selectedValueset];
                List <PXSqlValue> myOut       = new List <PXSqlValue>(tmpValueSet.NumberOfValues);
                foreach (string code in tmpValueSet.SortedListOfCodes)
                {
                    myOut.Add(mValues[code]);
                }
                return(myOut);
            }
        }
示例#3
0
        protected override void SetElimForPresentation()
        {
            string     tmpElim;
            PXSqlValue mValue;

            this.IsEliminatedByValue = false;

            List <decimal> NumberOfValuesInValuesets = new List <decimal>();


            if (pxsQueryVariable != null)
            {
                if (!string.IsNullOrEmpty(this.pxsQueryVariable.StructureId))
                {
                    tmpElim = meta.Config.Codes.EliminationN;
                }
                else
                {
                    PXSqlValueSet vs = this.ValueSets[selectedValueset];
                    NumberOfValuesInValuesets.Add(vs.NumberOfValues);
                    tmpElim = vs.Elimination;
                }
            }
            else
            {
                PXSqlValueSet vs = this.ValueSets[selectedValueset];
                NumberOfValuesInValuesets.Add(vs.NumberOfValues);
                tmpElim = vs.Elimination;
            }



            if (tmpElim == meta.Config.Codes.EliminationN || tmpElim.Length == 0)
            {
                if (!this.isSelected)
                {
                    throw new PCAxis.Sql.Exceptions.PxsException(11, this.Name);
                }
                else
                {
                    this.PaxiomElimination = PXConstant.NO;
                }
            }
            else if (tmpElim == meta.Config.Codes.EliminationA)
            {
                if (this.isSelected)
                {
                    // We have to compare values in the valuepool(s) with the values selected in the PxsFile

                    if (this.Values.Count == NumberOfValuesInValuesets[0])
                    {
                        this.PaxiomElimination = PXConstant.YES;
                    }
                    else
                    {
                        this.PaxiomElimination = PXConstant.NO;
                    }
                }
            }
            else
            { // An elimination value exist for the variable.
                if (this.isSelected)
                {
                    if (this.Values.TryGetValue(tmpElim, out mValue))
                    { // the elimination value is selected
                        this.PaxiomElimination = mValue.ValueCode;
                    }



                    else
                    { // The Elimination value is not selected.  Elimination in Paxiom should be NO.
                        this.PaxiomElimination = PXConstant.NO;
                    }
                }
                // If an elimiantion value exists and no values are selected for the variable, the elimination
                // value should be used when selecting data, and metadata should be marked as eliminated by value.
                else
                {
                    mValue           = new PXSqlValue();
                    mValue.ValueCode = tmpElim;

                    this.Values.Add(mValue.ValueCode, mValue);
                    this.IsEliminatedByValue = true;
                }
            }
        }
示例#4
0
        private void SetValueset()
        {
            valusetIds = new StringCollection();

            List <ValueSetRow> tmpList = new List <ValueSetRow>();

            //if (meta.HasSubTable)
            //{
            //    tmpList.Add(meta.MetaQuery.GetValueSetRow2(meta.MainTable.MainTable, meta.SubTables.GetSelectedSubTable().SubTable, this.Name));
            //}
            //else
            //{
            if (this.pxsQueryVariable == null || this.pxsQueryVariable.SelectedValueset == PXSqlKeywords.FICTIONAL_ID_ALLVALUESETS)
            {
                tmpList = meta.MetaQuery.GetValueSetRows2(meta.MainTable.MainTable, this.Name);
            }
            else
            //{
            //if (this.pxsQueryVariable.SelectedValueset == PXSqlKeywords.FICTIONAL_ID_ALLVALUESETS)
            //{
            //    tmpList = meta.MetaQuery.GetValueSetRows2(meta.MainTable.MainTable, this.Name);
            //}
            //else
            {
                tmpList.Add(meta.MetaQuery.GetValueSetRow(this.pxsQueryVariable.SelectedValueset)); // for selected valueset without subtable stored in pxs.
            }
            // }
            // }

            int NumberOfSelectedValueSets = tmpList.Count;

            mValueSets = new Dictionary <string, PXSqlValueSet>();
            int totalNumberOfValues = 0;

            List <string> elimValues = new List <string>();         // For the magicAll valueSet

            StringCollection tmpValuePres = new StringCollection(); // For the magicAll valueSet

            foreach (ValueSetRow vsr in tmpList)
            {
                mValueSet = new PXSqlValueSet(vsr);
                mValueSet.NumberOfValues = meta.MetaQuery.GetNumberOfValuesInValueSetById(mValueSet.ValueSet);

                totalNumberOfValues += mValueSet.NumberOfValues;

                mValueSets.Add(mValueSet.ValueSet, mValueSet);
                valusetIds.Add(mValueSet.ValueSet);

                // helpers for the magicAll
                elimValues.Add(mValueSet.Elimination);
                if (!tmpValuePres.Contains(mValueSet.ValuePres))
                {
                    tmpValuePres.Add(mValueSet.ValuePres);
                }
            }

            // Add the collection to the variable.
            this.ValueSets = mValueSets;
            this.TotalNumberOfValuesInDB = totalNumberOfValues;

            if (NumberOfSelectedValueSets == 1)
            {
                selectedValueset = mValueSet.ValueSet;
            }
            else
            {
                string allValuePres;
                if (tmpValuePres.Count == 1)
                {
                    allValuePres = tmpValuePres[0];
                }
                else
                {
                    allValuePres = "V"; //For valuepool TODO her må det endres slik at codes V legges i config fila
                }
                PXSqlValueSet magicAll = new PXSqlValueSet(this.PresText, tmpList[0].ValuePool, CheckMultValuesetElim(elimValues), metaQuery.DB.Codes.No, allValuePres);
                magicAll.NumberOfValues = totalNumberOfValues;
                this.ValueSets.Add(magicAll.ValueSet, magicAll);
            }
        }