web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

In x++ Create Contract class

(0) ShareShare
ReportReport
Posted on by 1,215

Hi guys,

I have to create a report for all invoiced sales order items where I'll group it against the item id. In the parameter two months will be given(eg: jan 2012 to august 2012) and the max period range is 12 months. And quantity should be shown in period range( according to month wise categories it in the column)

For example : jan month quantities in quantity period 1 and feb month quantity in quantity period 2 and so on.... The date used to filter is invoice date.

please give us example for that in the Contract class how to do in x++.

Thanks.

I have the same question (0)
  • Blue Wang Profile Picture
    on at

    HI Riyas,

    Add parameters then validate your range.

    Please check this if it's helpful: docs.microsoft.com/.../how-to-add-validation-to-a-data-contract-class

  • Riyas ahamed F Profile Picture
    1,215 on at

    Thanks for your replay blue wang,

    i already got it same thread so give us example : jan 2012 to august 2012.

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Riyas,

    You can create new Date type EDT and change Date day property to No. In the contract, you need to create 2 fields (fromDate and toDate) and use new EDT as type of them. In this case, you will see in the dialog value in MMYYYY format.

    In the report processing method you can apply date range by InvoiceDate. For example if you have query object you can use queryRange(dateStartMth(fromDate), dateEndMth(toDate)).

    PS. You need to use dateStartMth and dateEndMth as selected by user values in the dialog will still keep the day.

  • Blue Wang Profile Picture
    on at

    HI Riyas,

    About your quantity period 1 ,quantity period 2 ,  Do you mean period parameter?

    www.sqlservercentral.com/.../a-single-parameter-date-range-in-sql-server-reporting-services

  • Riyas ahamed F Profile Picture
    1,215 on at

    Thanks for your replay Sergei Minozhenko,

    how to use dateStartMth and dateEndMth dialog so that need to UI builder class Right if yes give me a example.  

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Riyas,

    The only place you need to use dateStartMth and dateEndMth in the dialog is the validation part and process report method on DP class.

    MyTransDate is new date type EDT with 'Date Day' property = None

    [
        DataContractAttribute,
    ]
    public class MyContract implements SysOperationValidatable
    {
        MyTransDate fromDate;
        MyTransDate toDate;
       
        [
            DataMemberAttribute('FromDate'),
            SysOperationGroupMemberAttribute('Period'),
            SysOperationDisplayOrderAttribute('1')
        ]
        public MyTransDate parmFromDate(MyTransDate _fromDate = fromDate)
        {
            fromDate = _fromDate;
    
            return fromDate;
        }
    
        [
            DataMemberAttribute('ToDate'),
            SysOperationGroupMemberAttribute('Period'),
            SysOperationDisplayOrderAttribute('2')
        ]
        public MyTransDate parmToDate(MyTransDate _toDate = toDate)
        {
            toDate = _toDate;
    
            return toDate;
        }
    
        public boolean validate()
        {
            boolean ret = true;
    
            if (!fromDate || !toDate)
            {
                //Both dates must be filled in.
                ret = checkFailed("@SYS71110");
            }
    
            if (ret)
            {
                if (dateStartMth(fromDate) > dateEndMth(toDate_)
                {
                    //From date cannot be greater than To date.
                    ret = checkFailed("@SYS120590");
                }
            }
    
            return ret;
        }
    
    }

  • Riyas ahamed F Profile Picture
    1,215 on at

    Thanks for your quickly response Sergei.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans