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

Announcements

News and Announcements icon
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
    Microsoft Employee 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,097 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
    Microsoft Employee 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,097 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 658 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 632 Super User 2026 Season 1

#3
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 570

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans