Example #1
0
 public PXSqlParser_21(PXSqlMeta_21 inPXSqlMeta)
 {
     mPXSqlMeta = inPXSqlMeta;
     if (mPXSqlMeta.inPresentationModus)
     {
         symbols = mPXSqlMeta.mPxsqlNpm;
     }
 }
Example #2
0
        ///
        /// <PXKeyword name="DATANOTECELL">
        ///   <rule>
        ///     <description>Sends codes from SpecialCharacter when found in datatables.</description>
        ///     <table modelName ="Maintable">
        ///     <column modelName="SpecCharExists"/>
        ///     </table>
        ///     <table modelName ="SpecialCharacter">
        ///     <column modelName="all"/>
        ///     </table>
        ///     <table modelName ="The datatables">
        ///       <column modelName="NPM columns and missing rows"/>
        ///     </table>
        ///   </rule>
        /// </PXKeyword>
        ///
        public void ParseMeta(PCAxis.Paxiom.IPXModelParser.MetaHandler handler, string preferredLanguage)
        {
            PXSqlNpm         myNpms = mMeta.mPxsqlNpm;
            StringCollection datanoteDistictValues = new StringCollection();
            string           keyword = PXKeywords.DATANOTECELL;
            StringCollection values;

            foreach (KeyValuePair <string, string> dcn in theDataNoteCellEntries)
            {
                PXSqlNpm.NPMCharacter myNpm = myNpms.GetNpmBySpeciaCharacterType(dcn.Value);
                foreach (string lang in mMeta.LanguageCodes)
                {
                    string presCharacter = myNpm.presCharacters[lang];
                    values = new StringCollection();
                    values.Add(presCharacter);
                    String myKey = dcn.Key.Replace(",", "\",\"");//for PXModelBuilder.SplittString   A","B","C
                    // not "A","B","C"
                    handler(keyword, lang, myKey, values);
                }
                // Keep distinct values of special character to get Presetext.
                if (!datanoteDistictValues.Contains(dcn.Value))
                {
                    datanoteDistictValues.Add(dcn.Value);
                }
            }

            keyword = PXKeywords.NOTE;
            foreach (string datanoteDistinctValue in datanoteDistictValues)
            {
                PXSqlNpm.NPMCharacter myNpm = myNpms.GetNpmBySpeciaCharacterType(datanoteDistinctValue);
                foreach (string lang in mMeta.LanguageCodes)
                {
                    string presText = myNpm.presCharacters[lang] + "=" + myNpm.presTexts[lang];
                    values = new StringCollection();
                    values.Add(presText);
                    handler(keyword, lang, null, values);
                }
            }
        }
Example #3
0
        private void BuildMeta()
        {
            SetInstanceModus();

            mMetaQuery.LanguageCodes = LanguageCodes; // instanced above, now just set language
            SetMetaModelVersion();                    // sjekker ikke mot pxs
            if (inPresentationModus)
            {
                mPxsqlNpm = new PXSqlNpm(this); //trenger valium dette
            }

            mPXMetaAdmValues = new PXMetaAdmValues(mMetaQuery.GetMetaAdmAllRows(), mMetaQuery.DB);


            SetMainTable();

            //mSubTables = new PXSqlSubTables(mMetaQuery.GetSubTableRows(mMainTableId), mPxsSubTableId);
            mSubTables = new PXSqlSubTables(mMetaQuery.GetSubTableRows(mMainTableId), mPxsFile, this);



            SetVariables(); //ok for pxs == null, men denne kan også hente ut valueSet
            SetContents();  //må skrives om, men kall til metaQ OK. Bør kanskje legge inn contents som
            SetHeadingAndStub();



            // hmm petros bruke TIMEVAL nøkkelord for å bestemme om en variabel er tid, men timeval
            // er ikke obligatorisk og har ingen mening i "valg modus".  Johannes trenger å vite om en
            //variabel er tid for å danne korrekt pxs.
            //     if (instancemodus == Instancemodus.presentation)
            //     {
            // SetTimeVal(); Not used. Defined in PXSqlVariableTime
            SetPaxiomMap();                                         //ok for pxs == null, men jeg forstår ikke helt hva den gjør.
            mEliminatedVariablesExist = CheckEliminatedVariables(); //ok for pxs == null
            SetFootNotes();                                         //  //ok for pxs == null trur eg
            mDataTablesPrefix = mMetaQuery.GetDataTablesPrefix(mMainTable.ProductId);
            CheckPxs();
        }
Example #4
0
        public PXSqlData_21(PXSqlMeta_21 mPXSqlMeta)
        {
            log.Debug("Start PXSqlData mPXSqlMeta.Name: " + mPXSqlMeta.Name);

            this.mMeta = mPXSqlMeta;


            symbols = mMeta.mPxsqlNpm;

            this.npm         = mMeta.SpecCharExists;
            this.hasGrouping = mMeta.HasGrouping;

            this.eliminationBySum = mMeta.EliminatedVariablesExist;

            //System.Console.WriteLine("DEBUG tukler med nmp og summ");
            //npm = true;
            //alwaysUseSum = true;

            this.useSum = hasGrouping || eliminationBySum;

            foreach (PXSqlVariable var in mMeta.Stubs)
            {
                keysInReverseOutputOrder.Add(var.Name);
            }

            foreach (PXSqlVariable var in mMeta.Headings)
            {
                keysInReverseOutputOrder.Add(var.Name);
            }
            keysInReverseOutputOrder.Reverse();

            numberOfOutputVariables = keysInReverseOutputOrder.Count;

            mValueCount  = new Dictionary <string, int>(numberOfOutputVariables);
            mIndexFactor = new Dictionary <string, int>(numberOfOutputVariables);

            foreach (PXSqlVariable var in mMeta.Variables.Values)
            {
                if (var.IsEliminatedByValue)
                {
                    log.Debug(var.Name + " Is Eliminated By Value");
                    keysOfEliminatedByValue.Add(var.Name);
                }
                else if (var.IsContentVariable)
                {
                    log.Debug(var.Name + " Is Content Variable");
                    theKeyOfTheContentsVariableVariable = var.Name;
                }
                else if (!var.isSelected)
                {
                    log.Debug(var.Name + " Is Eliminated By SUM");
                    keysOfEliminatedBySum.Add(var.Name);
                    eliminationFactor *= var.TotalNumberOfValuesInDB;
                }
            }

            #region init contKeys
            if (String.IsNullOrEmpty(theKeyOfTheContentsVariableVariable))   //just one contVar
            {
                throw new ApplicationException("Bug");
                // the size of ContentsVariableVariable should not influence how it is stored
                //                contKeys.Add( mMeta.FirstContents );
            }
            else
            {
                PXSqlVariable theContentsVariable = mMeta.Variables[theKeyOfTheContentsVariableVariable];
                foreach (PXSqlValue contCode in theContentsVariable.GetValuesForParsing())
                {
                    //contKeys.Add(contCode.ValueCode);
                    contKeys.Add(contCode.ContentsCode); // 2010.05.07  replaces line above because valuecode is now Prescode from contents. New contentscode added to PXSqlValue
                }
                foreach (string contCode in theContentsVariable.Values.Keys)
                {
                    //    contKeys.Add(contCode);
                }
            }

            #endregion init contKeys

            #region init defaults for missing rows
            //value to be used if row is missing
            ValueOfCellsInMissingRows    = new double[contKeys.Count];
            CategoryOfCellsInMissingRows = new string[contKeys.Count];

            int contCount2 = 0;

            anyDefaultMRNotZero = false;  // MR = missing record
            anyDefaultMROfCat3  = false;  // MR = missing record
            foreach (string contCode in contKeys)
            {
                PXSqlContent tmpCont = mMeta.Contents[contCode];
                log.Debug("PXSqlContents for " + contCode + " PresCellsZero:" + tmpCont.PresCellsZero + " PresMissingLine:" + tmpCont.PresMissingLine);

                CategoryOfCellsInMissingRows[contCount2] = tmpCont.CategoryOfCellsInMissingRows;
                ValueOfCellsInMissingRows[contCount2]    = tmpCont.ValueOfCellsInMissingRows;

                if (!CategoryOfCellsInMissingRows[contCount2].Equals("0"))
                {
                    anyDefaultMRNotZero = true;
                    if (CategoryOfCellsInMissingRows[contCount2].Equals("3"))
                    {
                        anyDefaultMROfCat3 = true;
                    }
                }
                contCount2++;
            }
            #endregion init defaults for missing rows

            log.Debug("eliminationFactor: " + eliminationFactor);



            log.Debug("useSum:" + useSum + " , npm: " + npm);
            log.Debug("Constructor done.");
        }