Skip to main content
Solved

Cannot create an abstract class.

  • December 24, 2025
  • 1 reply
  • 18 views

Forum|alt.badge.img+2

PXResultset<CSCalendarDate> calendarResults = PXSelect<CSCalendarDate,
                Where<CSCalendarDate.calendarID, In<Required<CSCalendarDate.calendarID>>>,
                OrderBy<Asc<CSCalendarDate.calendarID>>>
                .Select(Base, (object)calendarIDs);

 

List<CSCalendarDate> calendarDates = new List<CSCalendarDate>();

            foreach (PXResult<CSCalendarDate> res in calendarResults)
            {
                CSCalendarDate dateRow = res; 
                calendarDates.Add(dateRow);
            }

I have error at this  in calendarResults row.
 

Cannot create an abstract class.

Its my DAC:

    [Serializable]
    [PXCacheName(Messages.CalendarDate)]
    [PXProjection(typeof(SelectBase<CSCalendarDate, 
        LeftJoin<CSCalendarExceptions, On<CSCalendarDate.date, Equal<CSCalendarExceptions.date>,
            And<CSCalendarExceptions.workDay, Equal<False>>>>,
            Where<CSCalendarExceptions.date, IsNull>,
            Aggregate<GroupBy<CSCalendarDate.date, GroupBy<CSCalendarDate.calendarID>>>,
            OrderBy<Asc<CSCalendarDate.date>>>), Persistent = false)]
    public class CSCalendarDate : PXBqlTable, IBqlTable
    {
        #region CalendarID
        public abstract class calendarID : PX.Data.BQL.BqlString.Field<calendarID> { }
        [PXDBString(10, IsUnicode = true, BqlTable = typeof(CSCalendarDate))]
        public virtual string CalendarID { get; set; }
        #endregion

        #region Date
        public abstract class date : PX.Data.BQL.BqlDateTime.Field<date> { }
        [PXDBDate(BqlTable = typeof(CSCalendarDate))]
        public virtual DateTime? Date { get; set; }
        #endregion
    }

Best answer by aleksandrsechin

Hi ​@bihalivan15 

The issue is that you are using the SelectBase class in your projection, but SelectBase is an abstract class.

Also, I noticed that you are using your custom DAC in the PXProjected attribute for this DAC itself. Is this a typo, and did you mean the CSCalendar DAC instead? If so, here is an example of how your projection attribute could be rewritten using Fluent BQL:

using PX.Data.BQL.Fluent;

[PXProjection(typeof(SelectFrom<CSCalendar>
.LeftJoin<CSCalendarExceptions>
.On<CSCalendar.calendarID.IsEqual<CSCalendarExceptions.calendarID>
.And<CSCalendarExceptions.workDay.IsEqual<False>>>.
Where<CSCalendarExceptions.date.IsNull>.
AggregateTo<GroupBy<CSCalendarExceptions.date,
GroupBy<CSCalendarExceptions.calendarID>>>.
OrderBy<Asc<CSCalendarExceptions.date>>),
Persistent = false)]


I don’t know your exact business requirements, but you can adjust this code further to suit your needs.

1 reply

Forum|alt.badge.img+3
  • Jr Varsity I
  • Answer
  • December 24, 2025

Hi ​@bihalivan15 

The issue is that you are using the SelectBase class in your projection, but SelectBase is an abstract class.

Also, I noticed that you are using your custom DAC in the PXProjected attribute for this DAC itself. Is this a typo, and did you mean the CSCalendar DAC instead? If so, here is an example of how your projection attribute could be rewritten using Fluent BQL:

using PX.Data.BQL.Fluent;

[PXProjection(typeof(SelectFrom<CSCalendar>
.LeftJoin<CSCalendarExceptions>
.On<CSCalendar.calendarID.IsEqual<CSCalendarExceptions.calendarID>
.And<CSCalendarExceptions.workDay.IsEqual<False>>>.
Where<CSCalendarExceptions.date.IsNull>.
AggregateTo<GroupBy<CSCalendarExceptions.date,
GroupBy<CSCalendarExceptions.calendarID>>>.
OrderBy<Asc<CSCalendarExceptions.date>>),
Persistent = false)]


I don’t know your exact business requirements, but you can adjust this code further to suit your needs.