public override void RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
        {
            if (!_IsActive || _Fields == null)
            {
                return;
            }
            string firstColumn = e.Record.GetString(e.Position);
            var    sqlDialect  = sender.Graph.SqlDialect;

            string[] fetched;
            if (aggregateAttributes && sqlDialect.tryExtractAttributes(firstColumn, _AttributeIndices, out fetched))
            {
                sender.SetValue(e.Row, _FieldOrdinal, fetched);
                e.Position++;
                return;
            }

            int?nbr = e.Record.GetInt32(e.Position);

            e.Position++;
            if (nbr != null)
            {
                if (nbr > 0)
                {
                    fetched = new string[_Fields.Length];
                    sender.SetValue(e.Row, _FieldOrdinal, fetched);
                    for (int i = 0; i < fetched.Length; i++)
                    {
                        fetched[i] = e.Record.GetString(e.Position);
                        e.Position++;
                    }
                }
            }
            else
            {
                e.Position += _Fields.Length;
            }
        }
        public void RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
        {
            string firstColumn = e.Record.GetString(e.Position);
            var    sqlDialect  = sender.Graph.SqlDialect;

            string[] fetched;
            if (sqlDialect.tryExtractAttributes(firstColumn, _IndexByID, out fetched))
            {
                for (int i = 0; i < _IndexByID.Count; i++)
                {
                    string srcVal = fetched[i];
                    if (null == srcVal && _FieldTypes[i].IsValueType)
                    {
                        continue;
                    }

                    object val = Convert.ChangeType(fetched[i], _FieldTypes[i]);
                    sender.SetValue(e.Row, 1 + _FieldOrdinal + i, val);
                }
            }
            e.Position++;
            return;
        }
		protected virtual void LocationAPPaymentInfo_RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
		{
			if (e.Row != null)
			{
				LocationAPPaymentInfo record = (LocationAPPaymentInfo)e.Row;

				record.IsRemitAddressSameAsMain = object.Equals(record.VDefAddressID, record.VRemitAddressID);
				record.IsRemitContactSameAsMain = object.Equals(record.VDefContactID, record.VRemitContactID);
			}
		}
		protected override void Location_RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
		{
			if (e.Row != null)
			{
				Location record = (Location)e.Row;

				record.IsAPAccountSameAsMain = !object.Equals(record.LocationID, record.VAPAccountLocationID);
				record.IsAPPaymentInfoSameAsMain = !object.Equals(record.LocationID, record.VPaymentInfoLocationID);

				base.Location_RowSelecting(sender, e);
			}
		}
		protected virtual void SOInvoice_RowSelecting(PXCache sender, PXRowSelectingEventArgs e) 
		{
			if (e.Row != null && e.IsReadOnly == false && ((SOInvoice)e.Row).CuryPaymentTotal == null)
			{
				using (new PXConnectionScope())
				{
					bool IsReadOnly = (sender.GetStatus(e.Row) == PXEntryStatus.Notchanged);
					PXFormulaAttribute.CalcAggregate<ARAdjust.curyAdjdAmt>(Adjustments.Cache, e.Row, IsReadOnly);
					sender.RaiseFieldUpdated<SOInvoice.curyPaymentTotal>(e.Row, null);

					PXDBCurrencyAttribute.CalcBaseValues<SOInvoice.curyPaymentTotal>(sender, e.Row);
				}
			}
		}
		protected virtual void ARInvoice_RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
		{
			ARInvoice row = (ARInvoice)e.Row;
			
			if (row != null && e.IsReadOnly==false
				&& String.IsNullOrEmpty(row.DocType) == false && String.IsNullOrEmpty(row.RefNbr) == false)
			{
				row.IsCCPayment = false;
				using (new PXConnectionScope())
				{
					PXResult<CustomerPaymentMethodC, CA.PaymentMethod, SOInvoice> pmInstance = (PXResult<CustomerPaymentMethodC, CA.PaymentMethod, SOInvoice>)
										 PXSelectJoin<CustomerPaymentMethodC,
										InnerJoin<CA.PaymentMethod,
											On<CA.PaymentMethod.paymentMethodID, Equal<CustomerPaymentMethodC.paymentMethodID>>,
																			InnerJoin<SOInvoice, On<SOInvoice.pMInstanceID, Equal<CustomerPaymentMethodC.pMInstanceID>>>>,
									Where<SOInvoice.docType, Equal<Required<SOInvoice.docType>>,
										And<SOInvoice.refNbr, Equal<Required<SOInvoice.refNbr>>,
										And<CA.PaymentMethod.paymentType, Equal<CA.PaymentMethodType.creditCard>,
											And<CA.PaymentMethod.aRIsProcessingRequired, Equal<True>>>>>>.Select(this, row.DocType, row.RefNbr);
					if (pmInstance != null)
					{
						row.IsCCPayment = true;
					}
				}
			}
		}