// when no pxs internal void SetValues(StringCollection selSubTables) { ValueRow2HMDictionary mValueRowDictionary = meta.MetaQuery.GetValueRowDictionary(meta.MainTable.MainTable, selSubTables, this.Name, this.ValuePool.ValueTextExists); Dictionary <string, ValueRow2HM> mValueRows = mValueRowDictionary.ValueRows; this.Values = new PxSqlValues(); foreach (ValueRow2HM myValueRow in mValueRows.Values) { PXSqlValue mValue = new PXSqlValue(myValueRow, meta.LanguageCodes, meta.MainLanguageCode); this.Values.Add(mValue.ValueCode, mValue); } }
//when pxs internal void SetValues(StringCollection selSubTables, PQVariable var) { log.Debug("PQVariable code = " + var.code); StringCollection mSelectedValues = new StringCollection(); // Defines a dictionary to hold all the sortorders. Necessary because of the wildcards Dictionary <string, int> mDefinedSortorder = new Dictionary <string, int>(); DataSet mValueInfoTbl; DataRowCollection mValueInfo; string mPxsSubTableId = meta.PxsFile.Query.SubTable; #region foreach var.Values.Items if (var.Values.Items.Length > 0) { int documentOrder = 0; foreach (PCAxis.Sql.Pxs.ValueTypeWithGroup val in var.Values.Items) { if (val.Group != null) { //currentGrouping = ... //TODO; PXSqlVariableClassification, SetValues: group not implemented yet" throw new NotImplementedException("PXSqlVariableClassification, SetValues: group not implemented yet"); } if (val.code.Contains("*") || val.code.Contains("?")) { if (mPxsSubTableId == null) { mValueInfoTbl = meta.MetaQuery.GetValueWildCardBySubTable(meta.MainTable.MainTable, var.code, null, val.code); } else { mValueInfoTbl = meta.MetaQuery.GetValueWildCardBySubTable(meta.MainTable.MainTable, var.code, mPxsSubTableId, val.code); } mValueInfo = mValueInfoTbl.Tables[0].Rows; foreach (DataRow row in mValueInfo) { string mTempCode = row[meta.MetaQuery.DB.Value.ValueCodeCol.PureColumnName()].ToString(); mSelectedValues.Add(mTempCode); if (!mDefinedSortorder.ContainsKey(mTempCode)) { mDefinedSortorder.Add(mTempCode, documentOrder); } documentOrder++; } } else { mSelectedValues.Add(val.code); if (!mDefinedSortorder.ContainsKey(val.code)) { mDefinedSortorder.Add(val.code, documentOrder); } } documentOrder++; } #endregion foreach var.Values.Items // mSelectedValues now contains all the selected values, including those defined by wildcards Dictionary <string, PXSqlValue> mTempPXSqlValues = new Dictionary <string, PXSqlValue>(); List <PXSqlValue> mSortedValues = new List <PXSqlValue>(); ValueRow2HMDictionary mValueRowDictionary = meta.MetaQuery.GetValueRowDictionary(meta.MainTable.MainTable, selSubTables, var.code, mSelectedValues, this.ValuePool.ValueTextExists); //todo; fortsette her Dictionary <string, ValueRow2HM> mValueRows = mValueRowDictionary.ValueRows; #region foreach mValueRows foreach (ValueRow2HM myValueRow in mValueRows.Values) { PXSqlValue mValue = new PXSqlValue(myValueRow, meta.LanguageCodes, meta.MainLanguageCode); // jfi: kommentaren sto i en kodeblock som forsvant inn i PXSqlValue // todo; legge til sjekk om koden finnes blandt valgte i basen. mValue.SortCodePxs = mDefinedSortorder[myValueRow.ValueCode]; mSortedValues.Add(mValue); } #endregion foreach mValueRows mValues = new PxSqlValues(); foreach (PXSqlValue sortedValue in mSortedValues) { mValues.Add(sortedValue.ValueCode, sortedValue); } this.Values = mValues; } }