Question

Alway passing value to subreport even if i not passing it

  • 6 October 2023
  • 6 replies
  • 76 views

I got the next problem. I got report in which i have two field ProjectCD and TaskCD. TaskCD is not required and if it not selected it should show all task that project have.

I i run it only using subreport everything look good
Without task selected

With task selected
 

But for main report if i don’t select Task it alway will show first one.
 

But if i will select task it will show selected task
 

There are my params for main report for Task
 

Collection that i send to subreport
 

And params for subreport
 

And the view that i use for calculation values
 

[Serializable]
    [PXCacheName(CAMSPMProjectDetailsTransactionsTaskIDViewCacheName)]
    public class CAMSPMProjectDetailsTransactionsTaskIDView : IBqlTable
    {
        private const string CAMSPMProjectDetailsTransactionsTaskIDViewCacheName = "Project Details Transactions Task View";

        #region ProjectID
        [PXDBInt(IsKey = true)]
        public virtual int? ProjectID { get; set; }
        public abstract class projectID : BqlInt.Field<projectID> { }
        #endregion

        #region TaskID
        [PXDBInt(IsKey = true)]
        public virtual int? TaskID { get; set; }
        public abstract class taskID : BqlInt.Field<taskID> { }
        #endregion

        #region TaskCD
        [PXDBString(IsUnicode = true, /*IsKey = true,*/ InputMask = "")]
        [PXSelector(typeof(Search<PMTask.taskCD>),
            typeof(PMTask.taskCD), typeof(PMTask.description), typeof(PMTask.isActive),
            SubstituteKey = typeof(PMTask.taskCD), DescriptionField = typeof(PMTask.description))]
        public virtual string TaskCD { get; set; }
        public abstract class taskCD : BqlString.Field<taskCD> { }
        #endregion


        #region GroupCD
        [PXDBString(IsUnicode = true, IsKey = true, InputMask = "")]
        [PXDimensionSelector(AccountGroupAttribute.DimensionName,
        typeof(Search<PMAccountGroup.groupCD>),
        typeof(PMAccountGroup.groupCD),
            typeof(PMAccountGroup.groupCD), typeof(PMAccountGroup.description), typeof(PMAccountGroup.type), typeof(PMAccountGroup.isActive), DescriptionField = typeof(PMTask.description))]
        public virtual string GroupCD { get; set; }
        public abstract class groupCD : BqlString.Field<groupCD> { }
        #endregion

        #region GroupID
        [PXDBInt]
        public virtual int? GroupID { get; set; }
        public abstract class groupID : BqlInt.Field<groupID> { }
        #endregion

        #region Type
        [PXDBString(IsKey = true)]
        [PMAccountType.List]
        public virtual string Type { get; set; }
        public abstract class type : BqlString.Field<type> { }
        #endregion

        #region MTD
        [PXDBDecimal]
        [PXDefault(TypeCode.Decimal, "0.00", PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual decimal? MTD { get; set; }
        public abstract class mTD : BqlDecimal.Field<mTD> { }
        #endregion

        #region PTD
        [PXDBDecimal]
        [PXDefault(TypeCode.Decimal, "0.00", PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual decimal? PTD { get; set; }
        public abstract class pTD : BqlDecimal.Field<pTD> { }
        #endregion

        #region Commitment
        [PXDBDecimal]
        [PXDefault(TypeCode.Decimal, "0.00", PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual decimal? Commitment { get; set; }
        public abstract class commitment : BqlDecimal.Field<commitment> { }
        #endregion

        #region PDTPlusCommitment
        [PXDBDecimal]
        [PXDefault(TypeCode.Decimal, "0.00", PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual decimal? PDTPlusCommitment { get; set; }
        public abstract class pDTPlusCommitment : BqlDecimal.Field<pDTPlusCommitment> { }
        #endregion

        #region Budget
        [PXDBDecimal]
        [PXDefault(TypeCode.Decimal, "0.00", PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual decimal? Budget { get; set; }
        public abstract class budget : BqlDecimal.Field<budget> { }
        #endregion

        #region Variance
        [PXDBDecimal]
        [PXDefault(TypeCode.Decimal, "0.00", PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual decimal? Variance { get; set; }
        public abstract class variance : BqlDecimal.Field<variance> { }
        #endregion

        #region CreditGroup
        [PXDBDecimal]
        [PXDefault(TypeCode.Decimal, "0.00", PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual decimal? CreditGroup { get; set; }
        public abstract class creditGroup : BqlDecimal.Field<creditGroup> { }
        #endregion


        #region CreditGroupMTD
        [PXDBDecimal]
        [PXDefault(TypeCode.Decimal, "0.00", PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual decimal? CreditGroupMTD { get; set; }
        public abstract class creditGroupMTD : BqlDecimal.Field<creditGroupMTD> { }
        #endregion
    }


6 replies

Userlevel 4
Badge +2

What is your join condition?

I assume you are joining on Task.TaskID = [TaskID]

but I would do where (Task.TaskID = [TaskID] or [TaskID] is null) to get either that task, or ALL tasks if the parameter is null. 

I have condition for taskID is null there

There is join for main report and for subreport i don’t have any joins because i use my view with calculated values
 

 

Userlevel 7
Badge +4

@VadymBoichenko96 Can you provide a zip file of your report and subreport so we can try to review it? I suspect it is something which is being passed to the subreport, but it’s hard to tell without checking the configuration

I added customization also because i used values from SQL view. And dll with this DAC that i use for SQL view

Userlevel 7
Badge +4

@VadymBoichenko96 I think the issue might be because you are displaying the subreport in the page header.

I tested with a subreport I made and placed this in the Detail section and it worked to repeat the sections for each task:

 

Is this the type of behavior you were looking for?

Yeah i know that if paste it to details section it will show task but on diferent pages. I whant get result like this
 

you can see it if you make this condition for subreport for income

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved