Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا
Showing posts with label SSRS reports. Show all posts
Showing posts with label SSRS reports. Show all posts

Sunday, August 22, 2021

How to add ranges in SSRS in design level

 Hi,

In the Tablix property of the grid we add the filter in any rages.

NOTE: 

1. All the operator are common and except  < > . This < > for != Not equals to ranges.

2. We cant add multiple ranges of same filed in same expression values whereas we need to create n number of filters against the expression to add ranges accordingly.

3. Working on Row visibiliy expression is not recomended to achiew this ranges.

4. To have AND condition in the value needs to add between Value1 and Value2



Regards,

Wednesday, July 14, 2021

Alternative row colors with different scope in SSRS

 Hi,


Alternative colors without any scope or condiction.

=iif(RowNumber(Nothing) Mod 2, "#ffffff", "#f0f0f0") 


Alternative colors with scope or condiction.

=IIF(RunningValue(Fields!CustId.Value, CountDistinct, Nothing) MOD 2 = 1, "#ffffff", "#f0f0f0") 


We can display alternative colors based on distinct running values or by parent groups or specific condition like

=IIF(Fields!Amount.Value > 35000 , "#ffffff", "#f0f0f0") 


Even we can achive group with in group cases and Matrix cases by selecting particular cells.


Regards

Monday, December 2, 2013

The SQL server reporting Service service is running -SSRS 2012

Solution for this error: 
The deployment was cancelled because of an error:
On the reporting server, |Verify that
The SQL server reporting Service service is running

Solution:

1. Check Local business connector is optimum/ correct.
2. Check Domain business connector is optimum/ correct.
3. Put increment CIL
Now deploy it will be deployed.
Regards,\

Tuesday, November 26, 2013

How to give null/ space if the values is zero in SSRS 2012

Hi,
 Just enter the syntex as expression for SSRS
=iif(Fields!FieldName.Value > 0,  Fields!FieldName.Value,  space(0))

Regards,

Monday, September 23, 2013

Job to save the SSRS in PDF at given location in Dynamic AX

Hi,
static void SaveSSRSasPdfCode(Args _args)
{
     SrsReportRun srsReportRun;

    srsReportRun = new SrsReportRun("ReportName.PrecisionDesign1");

    srsReportRun.init();
    srsReportRun.reportCaption("ReportName.PrecisionDesign1");
    //Parameter to be passed
    srsReportRun.reportParameter("TableNameused").value("Parameter");
    srsReportRun.showDialog(false);

    // Print to a file as ur name and location in HTML/PDF format.
    srsReportRun.printDestinationSettings().printMediumType(SRSPrintMediumType::File);
    srsReportRun.printDestinationSettings().fileFormat(SRSReportFileFormat::PDF);
    srsReportRun.printDestinationSettings().overwriteFile(true);
    srsReportRun.printDestinationSettings().fileName(@"C:\UrReportName.pdf");

    if( srsReportRun )
    {
        srsReportRun.executeReport();
    }
}

Sunday, September 22, 2013

Job to run reports without knowing the used class names in Dynamic AX

static void PrintSSRSthroughCode(Args _args)
{
    SrsReportRun srsReportRun;
    srsReportRun = new SrsReportRun ("ReportName.PrecisionDesign1");
    srsReportRun.init();
    srsReportRun.reportCaption("ReportName.PrecisionDesign1");
    // set parameters
    srsReportRun.reportParameter("TableName").value("Parameter");
    // Dialog for failure (if)
    srsReportRun.showDialog(false);
    if( srsReportRun )
    {
             srsReportRun.executeReport();
    }
}

Thursday, September 19, 2013

Validate the contract class or SSRS parameter from code level before printing

Just add below code in contract class so that mandatory  fields like date fields can be validated by throwing the warning.

public boolean validate()
{
    boolean             isValid = true;

    if (!fromDate)
    {
        isValid = checkFailed("From Date should be entered");
    }

    if (!toDate)
    {
        isValid = checkFailed("To Date should be entered");
    }

    if (isValid && (fromDate > toDate))
    {
        isValid = checkFailed(strfmt("From Date should be less than or equal to To Date", date2StrUsr(fromDate, DateFlags::FormatAll), date2StrUsr(toDate, DateFlags::FormatAll)));
    }

    return isValid;
}

Tablix headers not repeating in SSRS

Hi,
To repeat tablix header through out the ssrs (all pages)
1. In the grouping pane, make sure to turn on advanced mode (click on the small black down arrow on the far right of the grouping pane)
2. Select the corresponding (Static) item in the row group hierarchy
3. In the properties grid, set RepeatOnNewPage to true
4. KeepwithGroup to After



Monday, September 16, 2013

what is the difference between Hidden and Internal in Parameter visibility ? in SSRS

Hi,
let me say you Develop a Report which has a parameter as  User!userID.Value (Named as EmployeeID in Reports)  to Filter your Data in the Reports and this is captured when user logs into Report Manager.
Case 1:
If you have this EmployeeID  as Internal you cant change this Value by passing this Value in URL.
Case 2:
If you have this EmployeeID  as Hidden and Deployed it..you can OverRide User!userID.Value by passing this Value in URL Like this ..
http://server/reportserver?/Sales/Northwest/Employee Sales Report&rs:Command=Render&EmployeeID=1234
Employee 1234 can pass 1235 and see his Data which will be security threat.
Hope this Clarifies your Doubt.

Wednesday, August 28, 2013

Job to run the DP class in Dynamic AX

static void Job2runDP(Args _args)
{

    TenantBalanceDetailsTmpTbl TenantBalanceDetailsTmpTbl; //temp table name
    Query q;
    TenantBalanceBuildingLevRDP dataProvider = new TenantBalanceBuildingLevRDP();
//DP class name
    TenantBalanceBuildingLevContract contract = new TenantBalanceBuildingLevContract();
//contract class name
    contract.parmNetBuildingId('CEU-000022');
//parameter that you passing in contract class
    q = dataProvider.parmQuery();
    dataProvider.parmDataContract(contract);
    dataProvider.processReport();
    TenantBalanceDetailsTmpTbl = dataProvider.getTenantBalanceDetailsTmpTbl();
    while select TenantBalanceDetailsTmpTbl group by buildingId
    {
                print(TenantBalanceDetailsTmpTbl.BuildingId);
//Just print the filed that you want see the output
                print(TenantBalanceDetailsTmpTbl.TotalCredit);
                print(TenantBalanceDetailsTmpTbl.TotalDebit);
                print(TenantBalanceDetailsTmpTbl.BalanceCredit);
                print(TenantBalanceDetailsTmpTbl.BalanceDebit);

    }
    pause;
}

Company image in SSRS 2012

1. Create a field as Companyimg in the temp table
2. In the properties of that field select the extended datatypes as "Bitmap".
 use the below code to insert
TmpTbl.Comapanyimg = CompanyImage::findByRecord(CompanyInfo::find()).Image;
3. In Visual studio  right click insert image .
a. Source : database
b. field select the companyimg
c. as bitmap format in format selection

Alternative color in SSRS 2012

Write in the expression in SSRS
=iif(RowNumber(Nothing) Mod 2, "White", "WhiteSmoke")

or use

=IIF(RunningValue(Fields!BuildingId.Value,COUNTDISTINCT,NOTHING) MOD 2 = 0,"WhiteSmoke","White")

//Here BuildingId is the group by value to have alternative color for every group.

Tuesday, August 27, 2013

Complete company name as expression in SSRS 2012

Expression in SSRS

=Microsoft.Dynamics.Framework.Reports.DataMethodUtility.PostDataMethodEvaluation(Microsoft.Dynamics.Framework.Reports.DataMethodUtility.UpdateAxContextPartition(Parameters!AX_CompanyName.Value, Parameters!AX_UserContext.Value, Parameters!AX_RenderingCulture.Value, Parameters!AX_PartitionKey.Value),Microsoft.Dynamics.Framework.Reports.DataMethodUtility.GetFullCompanyNameForUser(Parameters!AX_CompanyName.Value, Parameters!AX_UserContext.Value))

Wednesday, August 7, 2013

Debug the report in AX 2012


Hi


static void AlfasithDpDebug(Args _args)
{

    NQ_smmActivitiesDP    NQ_smmActivitiesDP;
    NQ_smmActivitiesDP   dataprovider = new NQ_smmActivitiesDP();
    NQ_smmactivitiesContract contract = new NQ_smmactivitiesContract();
    smmActivitiesTmp      smmActivitiesTmp;
    query q;

    contract.param_application(5637147580);
    q = dataprovider.parmQuery();
    //q.dataSourceTable(tableNum(SalesQuotationTable)).addRange(fieldNum(SalesQuotationTable, WorkerSalesResponsible)).value(""); //000545"); //"000042"); //"DNG998877");
    q.dataSourceTable(tableNum(smmActivities)).addRange(fieldNum(smmActivities, responsibleworker)).value(""); //000545"); //"000042"); //"DNG998877");
    dataprovider.parmDataContract(contract);
    dataprovider.processReport();
    smmActivitiesTmp = dataprovider.getsmmActivitiesTmp();

     select firstOnly smmActivitiesTmp;
    print smmActivitiesTmp.NQ_NContactperson;
   //print smmActivitiesTmp;
    pause;
    }

Wednesday, July 24, 2013

How to add multiple parameter in to SSRS report as Query range in Dynamic AX

Hi,
Adding the fields in the Contract directly reflect on the parameter fields in the report dialog.
Adding the QueryBuildRange and its datasource makes the querying of the ranges value.

CategoryContractClass:
[
    DataContractAttribute,
    SysOperationGroupAttribute('Case', "Case",'1'),
    SysOperationGroupAttribute('Date', "Date",'2'),
    SysOperationGroupAttribute('PrintOut', "@SYS12608", '3')

]
public class CategoryContract implements SysOperationValidatable
{

    FromDate   FromDate;
    ToDate     ToDate;
    CaseCategoryType CaseCategoryType;
    CaseCategory CaseCategory;
}
/******************************************************************/
[
    DataMemberAttribute('CaseCategory'),
    SysOperationLabelAttribute(literalstr("Case Category")),
    SysOperationHelpTextAttribute(literalstr("Case Category")),
    SysOperationGroupMemberAttribute('Case'),
    SysOperationDisplayOrderAttribute('2')

]
public CaseCategory parmCaseCategory(CaseCategory _CaseCategory = CaseCategory)
{

    CaseCategory = _CaseCategory;
    return CaseCategory;

}
/******************************************************************/
[
    DataMemberAttribute('CaseCategoryType'),
    SysOperationLabelAttribute(literalstr("Category Type")),
    SysOperationHelpTextAttribute(literalstr("Category Type")),
    SysOperationGroupMemberAttribute('Case'),
    SysOperationDisplayOrderAttribute('1')

]
public CaseCategoryType parmCaseCategoryType(CaseCategoryType _CaseCategoryType = CaseCategoryType)
{

    CaseCategoryType = _CaseCategoryType;
    return CaseCategoryType;

}

/******************************************************************/
[
    DataMemberAttribute('FromDate'),
    SysOperationLabelAttribute(literalstr("From Date ")),
    SysOperationHelpTextAttribute(literalstr("From Date")),
    SysOperationGroupMemberAttribute('Date'),
    SysOperationDisplayOrderAttribute('1')

]
public FromDate parmFromDate(FromDate _FromDate = FromDate)
{

    FromDate = _FromDate;
    return FromDate;

}

/******************************************************************/
[
    DataMemberAttribute('ToDate'),
    SysOperationLabelAttribute(literalstr("To Date")),
    SysOperationHelpTextAttribute(literalstr("ToDate")),
    SysOperationGroupMemberAttribute('Date'),
    SysOperationDisplayOrderAttribute('2')

]
public ToDate parmToDate(ToDate _ToDate = ToDate)
{

    ToDate = _ToDate;
    return ToDate;

}

/******************************************************************/
public boolean validate()
{
    boolean             isValid = true;
    if (!CaseCategoryType)
    {
        isValid = checkFailed("Category Type should be entered");
    }
     return isValid;
}
/******************************************************************/
CategoryDPClass
[
SRSReportQueryAttribute(queryStr(CategoryQry)),
SRSReportParameterAttribute(classStr(CategoryContract))
]
class CategoryDP extends SRSReportDataProviderBase
{
    CategoryTmp  CategoryTmp;
    CaseCategory CaseCategory;
    CaseCategoryType CaseCategoryType;
    FromDate FromDate;
    ToDate ToDate;
}
/******************************************************************/
private Query buildQuery( Query             _query,
                          CaseCategoryType  _CaseCategoryType,
                          CaseCategory      _CaseCategory,
                          FromDate          _FromDate,
                          ToDate            _ToDate)
    {

        if(_CaseCategoryType)
            _query.dataSourceTable(tablenum(CaseCategoryHierarchyDetail),1).addRange(fieldnum(CaseCategoryHierarchyDetail, CategoryType)).value(queryValue(_CaseCategoryType));

       if(_CaseCategory)
           _query.dataSourceTable(tablenum(CaseCategoryHierarchyDetail),1).addRange(fieldnum(CaseCategoryHierarchyDetail, CaseCategory)).value(queryValue(_CaseCategory));

        if(_FromDate && _ToDate)
          _query.dataSourceTable(tablenum(CaseDetailBase),1).addRange(fieldnum(CaseDetailBase, CreatedDateTime)).value(queryRange(_FromDate,_ToDate));

        return _query;

     }
/******************************************************************/
[
SRSReportDataSetAttribute(tableStr(CategoryTmp))
]
public CategoryTmp getCategoryTmp()
{

    select * from CategoryTmp;
    return CategoryTmp;

}
/******************************************************************/
private void getReportParameters()
{

    CategoryContract CategoryContract = this.parmDataContract();
    if (CategoryContract)
     {

         CaseCategoryType     = CategoryContract.parmCaseCategoryType();
         CaseCategory         = CategoryContract.parmCaseCategory();
         FromDate             = CategoryContract.parmFromDate();
         ToDate               = CategoryContract.parmToDate();

     }

 }
/******************************************************************/
public void InsertCategoryTmp(CaseDetailBase _CaseDetailBase,CaseCategoryHierarchyDetail _CaseCategoryHierarchyDetail)
{
    HcmWorker HcmWorker;
    DirPartyTable DirPartyTable;
    CaseDetailBase CaseDetailBase;
    CategoryTmp.CaseId      = _CaseDetailBase.CaseId;
    CategoryTmp.Logo        = CompanyImage::findByRecord(CompanyInfo::find()).Image;
   // CaseCategoryTmp.Name        = _CaseDetailBase.displayOwnerName();
    CategoryTmp.Status      = _CaseDetailBase.Status;
    CategoryTmp.Description = _CaseDetailBase.Description;
    CategoryTmp.Priority    = _CaseDetailBase.Priority;
   // CaseCategoryTmp.OwnerWorker = _CaseDetailBase.OwnerWorker;
    select DirPartyTable join HcmWorker join CaseDetailBase where DirPartyTable.RecId == HcmWorker.Person
                          && CaseDetailBase.CaseId == _CaseDetailBase.CaseId
                          && CaseDetailBase.OwnerWorker == HcmWorker.RecId;
    CategoryTmp.Name = DirPartyTable.Name;

    CategoryTmp.DateTime    = _CaseDetailBase.createdDateTime;
    CategoryTmp.CategoryType = _CaseCategoryHierarchyDetail.CategoryType;
    CategoryTmp.CaseCategory = _CaseCategoryHierarchyDetail.CaseCategory;
    CategoryTmp.insert();

}
/******************************************************************/
[SysEntryPointAttribute(false)]
public void processReport()
{

    CaseDetailBase              CaseDetailBase;
    CaseCategoryHierarchyDetail CaseCategoryHierarchyDetail;
     QueryRun queryrun;
    ;
    this.getReportParameters();
    queryRun = new QueryRun(this.buildQuery(this.parmQuery(),CaseCategoryType,CaseCategory,FromDate,ToDate));
    //queryRun = new QueryRun(this.parmQuery());
    while(queryRun.next())
    {
         CaseDetailBase                   =queryrun.get(tableNum(CaseDetailBase));
         CaseCategoryHierarchyDetail      =queryrun.get(tableNum(CaseCategoryHierarchyDetail));
        this.InsertCategoryTmp(CaseDetailBase , CaseCategoryHierarchyDetail);
    }
}
/******************************************************************/

Cross row manipulation of SSRS reports 2012

Hi,

Cross summation or manipulation in SSRS reports.
Consider the below image has credits and debit, The Balance is calculated by 
=Credit - Debit + Balance.



 From my knowledge it is not possible in Visual Studio. Instead we can make this possible by below procedure.
1.Create a field in the temp table as balance.
2. In contract class just in the insert method make this 
TmpTableName.Balance =  TmpTableName.Balance + TmpTableName.Credit - TmpTableName.Debit ;
3.Refresh the dataset add the fields in to the expected position then observe the application.

Enjoy it 

Tuesday, July 23, 2013

Change company in Dynamics AX 2009

Hi, 

In Microsoft Dynamics AX Axapta, sometimes, we can to insert/update/delete records in different companies or insert/update/delete according to the company we are... 

In Dynamics AX, exists the "changeCompany" function, that allow us to do that easily.

Here's an example:



static void main()
{
    CustTable custTable;
    ;

    //Assume that you are running in company 'aaa'.
    changeCompany('bbb') //Default company is now 'bbb'.
    {
        custTable = null;
        while select custTable
        {
            //custTable is now selected in company 'bbb'.
        }
    }


    //Default company is again set back to 'aaa'.

    changeCompany('ccc') //Default company is now 'ccc'.
    {  
        //Clear custTable to let the select work
        //on the new default company.
        custTable = null;
    

        while select custTable
        {
            //custTable is now selected in company 'ccc'.
        }  
    }

    //Default company is again 'aaa'.

}

Wednesday, July 17, 2013

Save the SSRS report as pdf or print it through code in Dynamic AX

Ax 2012 Reports (SSRS) Print Utilities
This article gives the examples, to print the reports of Dynamics Ax 2012 (SSRS Reports), in different ways.
1)Sending the Ax report through mail.
2)Save the report as file in local computer. (example covered to save the report as .pdf file)
Mail the report

static void myJobPrintReportMail(Args _args)
{
SrsReportRun                        reportRun;
Query                               query;
SRSReportPrintDestinationSettings   SRSReportPrintDestinationSettings;
SRSPrintDestinationSettings         srsPrintSettings;
;
delete_from SRSReportPrintDestinationSettings;
reportRun = new SRSReportRun();
reportRun.reportName(“Vend.Report”);  //<ReportName>.<DesignName>
// Set printersettings
srsPrintSettings = reportRun.printDestinationSettings();
srsPrintSettings.printMediumType(SRSPrintMediumType::Email);
srsPrintSettings.emailTo(“mail@gmail.com”);
srsPrintSettings.emailAttachmentFileFormat(SRSReportFileFormat::PDF);
srsPrintSettings.emailSubject(strfmt(‘vendor report – %1′, systemdateget()));
srsPrintSettings.pack();
reportRun.showDialog(false);
reportRun.init();
reportRun.run();
}
Save the Report To PDF File
static void myJobPrintReportPDF(Args _args)
{
SrsReportRun                        reportRun;
SRSPrintDestinationSettings         srsPrintSettings;
SRSReportPrintDestinationSettings   SRSReportPrintDestinationSettings;
;
delete_from SRSReportPrintDestinationSettings;
reportRun = new SRSReportRun();
reportRun.reportName(“Vend.Report”);  //<ReportName>.<DesignName>
// Set printersettings
srsPrintSettings = reportRun.printDestinationSettings();
srsPrintSettings.overwriteFile(true);
srsPrintSettings.printMediumType(SRSPrintMediumType::File);
srsPrintSettings.fileFormat(SRSReportFileFormat::PDF);
srsPrintSettings.fileName(“D:\\Vendors.pdf”);
srsPrintSettings.pack();
reportRun.showDialog(false);
//reportRun.saveParameters();                         //For Report parameters
reportRun.init();
reportRun.run();
}
In case of Parameterized reports
If the report has parameters (Using Contract Class),
Use the following line, to read the parameters and save to the table called,SRSReportParameters
reportRun.saveParameters();
For the same parameters, provide the required values to run the report.
I have tried the example of Vendor Transactions report, with my customized version. This standard report has 4 parameters, have used same parameters and provided the values inSRSReportParameters table to run the report.
For clear idea, have a quick look in to the following picture.



UI Builder class in Dynamic AX

UI Builder class 

Today i will share how to give a filter lookup using an UI Builder class.                                                                                            

Step1 : First create a DP class for a customer report


[
    SRSReportQueryAttribute(queryStr(BSCustTable)),
    SRSReportParameterAttribute(classStr(SRCustomLookUpContract))

]
class SRCustomLookupDP extends SRSReportDataProviderBase
{
    SRCustomLookUpContract contract;
    CustNameTmp        CustNameTmp;
    AccountNum         AccountNum;
    CustGroupId       CustGroupId;

}

private Query buildQuery(
    Query                   _query,
    AccountNum                _AccountNum
    )
    {

    if(_AccountNum)
        _query.dataSourceTable(tablenum(CustTable), 1).addRange(fieldnum(CustTable, AccountNum)).value(queryvalue(_AccountNum));

        return _query;
     }

[
    SRSReportDataSetAttribute('CustNameTmp')
]
public CustNameTmp getCustNameTmp()
{
    select * from CustNameTmp;

    return CustNameTmp;
}

private void getReportParameters()
{
    SRCustomLookUpContract SRCustomLookUpContract = this.parmDataContract();

    if (SRCustomLookUpContract)
    {
        AccountNum    = SRCustomLookUpContract.parmAccountNum();
        CustGroupId  = SRCustomLookUpContract.parmCustGroup();
        //AccountNum    = SRCustomLookUpContract.parmAccountNum2();
    }
 }


public  void insertCustNameTmp(AccountNum _accountNum)
{
    CustTable  CustTable;

    ;
    while select CustTable where CustTable.AccountNum == _accountNum
    {
       CustNameTmp.AccountNum = _accountNum;
       CustNameTmp.Name     = CustTable.name();

       CustNameTmp.insert();
    }

}


/// <summary>
/// executes the logic based on the parameter entries
/// </summary>
/// <remarks>
/// fills up the temp table
/// </remarks>
[SysEntryPointAttribute]
public void processReport()
{
    Query query;
    QueryRun queryRun;
    CustTable       custTable;
    ;
    this.getReportParameters();
    queryRun = new QueryRun(this.buildQuery(this.parmQuery(),AccountNum));
    while(queryRun.next())
    {
        custTable = queryRun.get(tableNum(custTable));
        this.insertCustNameTmp(custTable.AccountNum);
    }
}

Step2 : Second create a Contract class for a customer report


[DataContractAttribute,
SysOperationContractProcessingAttribute(classstr(SRCustomLookupsUIBuilder))
]
class SRCustomLookUpContract
{
    AccountNum        accountNum;
    CustGroupId      CustGroupId;

}


[DataMemberAttribute('AccountNum')
    ]
public AccountNum parmAccountNum(AccountNum _accountNum = accountNum)
{
    accountNum = _accountNum;
    return accountNum;
}


[DataMemberAttribute('CustGroup')
    ]
public CustGroupId parmCustGroup(CustGroupId _CustGroupId = CustGroupId)
{
    CustGroupId = _CustGroupId;
    return CustGroupId;
}


Step3 : Third create a UI Builder class for a customer report


class SRCustomLookupsUIBuilder extends SrsReportDataContractUIBuilder
{
      DialogField   dialogAccountNum,dialogCustGroup; //dialogCreditRating;
      DialogGroup   dialogGroup, dialogGroup2;
      boolean       enable;


}


private void accountNumLookup(FormStringControl accountNumLookup)
{
    Query                   query = new Query();
    QueryBuildDataSource    qbds_CustTable;
    SysTableLookup          sysTableLookup;
    QueryBuildRange         qbr;

    if (accountNumLookup != null)
    {
        // Create an instance of SysTableLookup with
        // the current calling form control.

        sysTableLookup = SysTableLookup::newParameters(tablenum(CustTable), accountNumLookup);
        //sysTableLookup.addLookupMethod(
        // Add fields to be shown in the lookup form.
        qbds_CustTable = query.addDataSource(tableNum(CustTable));
         sysTableLookup.addLookupfield(fieldnum(CustTable, CustGroup),true);
        sysTableLookup.addLookupfield(fieldnum(CustTable, AccountNum), false);

        qbr = qbds_CustTable.addRange(fieldNum(CustTable,CustGroup));
        qbr.value("");
        sysTableLookup.parmUseLookupValue(false);

        sysTableLookup.parmQuery(query);

        // Perform the lookup.
        sysTableLookup.performFormLookup();

    }
}


/// <summary>
///    Builds the dialog.
/// </summary>
/// <remarks>
///    The dialog appears with the parameters.
/// </remarks>

public void build()
{
    SRCustomLookUpContract rdpContract =  this.dataContractObject();

    dialogAccountNum = this.addDialogField(methodstr(SRCustomLookUpContract,parmAccountNum),rdpContract);
    dialogAccountNum.lookupButton(3);

    dialogCustGroup = this.addDialogField(methodstr(SRCustomLookUpContract,parmCustGroup),rdpContract);
    dialogAccountNum.lookupButton(2);
}


private void CustGroupLookup(FormStringControl CustGroupLookup)
{
    Query                   query = new Query();
    QueryBuildDataSource    qbds_CustTable;
    SysTableLookup          sysTableLook;
    QueryBuildRange         qbr;
    CustTable               CustTable;
    if (CustGroupLookup != null)
    {
        // Create an instance of SysTableLookup with
        // the current calling form control.

        sysTableLook = SysTableLookup::newParameters(tablenum(CustTable), CustGroupLookup);
        //sysTableLookup.addLookupMethod(
        // Add fields to be shown in the lookup form.
        qbds_CustTable = query.addDataSource(tableNum(CustTable));
        sysTableLook.addLookupfield(fieldnum(CustTable, CustGroup),false);
         sysTableLook.addLookupfield(fieldnum(CustTable, AccountNum), true);

        qbr = qbds_CustTable.addRange(fieldNum(CustTable,CustGroup));
        qbr.value(dialogAccountNum.value());
        sysTableLook.parmUseLookupValue(false);

        sysTableLook.parmQuery(query);

        // Perform the lookup.
        sysTableLook.performFormLookup();

    }
}


public boolean customerAccModified(FormStringControl _control)
{
    dialogAccountNum.value(_control.valueStr());

    return true;
}


public void postRun()
{
    Dialog dialogLocal = this.dialog();
    DialogField dialogField, dialogField1;

    super();

    // This method should be called in order to handle events on dialogs.
    dialogLocal.dialogForm().formRun().controlMethodOverload(false);

    // Override the methods of department  field.

    dialogField1 = this.bindInfo().getDialogField(this.dataContractObject(), methodstr(SRCustomLookUpContract, parmCustGroup));
    dialogField1.registerOverrideMethod(methodstr(FormStringControl, lookup), methodstr(SRCustomLookupsUIBuilder,CustGroupLookup), this);

    dialogField = this.bindInfo().getDialogField(this.dataContractObject(), methodstr(SRCustomLookUpContract, parmAccountNum));
    dialogField.registerOverrideMethod(methodstr(FormStringControl, lookup), methodstr(SRCustomLookupsUIBuilder,accountNumLookup), this);

}

RDP Class in Dynamic AX

Style 1.

[
SRSReportQueryAttribute (querystr(CustTableQry)),
SRSReportParameterAttribute(classstr(CustContractClass))
]
class CustTableRDP extends SRSReportDataProviderBase
{
CustTableTmp custTableTmp;
}
*********************************
[
SysEntryPointAttribute(false)
]
public void processReport()
{
QueryRun             queryRun;
Query                query;
CustTable            custTable;
CustContractClass    CustContractClass;
AccountNum           accountNum;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange     queryBuildRange;
query = this.parmQuery();
   
CustContractClass = this.parmDataContract() as CustContractClass;
accountNum = CustContractClass.parmAccountNum();
// Add parameters to the query.
queryBuildDataSource = query.dataSourceTable(tablenum(CustTable));
if(accountNum)
{
queryBuildRange = queryBuildDataSource.findRange(fieldnum(CustTable, AccountNum));
if (!queryBuildRange)
{
queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, AccountNum));
}
// If an account number has not been set, then use the parameter value to set it.
if(!queryBuildRange.value())
        queryBuildRange.value(accountNum);
}
queryRun = new QueryRun(query);
while(queryRun.next())
{
custTable = queryRun.get(tableNum(CustTable));
this.insertTmpTable(CustTable);
}
}
________________________________________________
/// This method inserts data into the temporary table.
/// Table buffer of CustTable table.

private void insertTmpTable(CustTable _custTable)
{
custTableTmp.AccountNum = _custTable.AccountNum;
custTableTmp.Blocked = _custTable.Blocked;
custTableTmp.PriceGroup = _custTable.PriceGroup;
custTableTmp.Currency = _custTable.Currency;
custTableTmp.insert();

}
____________________________________________
[SRSReportDataSetAttribute("CustTableTmp")]
public custTableTmp getcustTableTmp()
{
select * from custTableTmp;
return custTableTmp;
}

Styel 2
// *************Alternative code sample*************//

SSRS report DP class And Contract Class Example
/// <summary>
///    The <c>LedgerJournalDP</c> class declares the variables, tables, and so on, that are used in the
///    <c>LedgerJournal</c> report.
/// </summary>
[
    SRSReportQueryAttribute(queryStr(HcmWareHouseQry)),
    SRSReportParameterAttribute(classStr(WareHouseReportContract))
]
public class WarehouseReportDP extends SRSReportDataProviderBase
{
    WarehouseTmp WarehouseTmp;
    TransDate    fromDate;
    TransDate    toDate;
 }
 private Query buildQuery(    Query                   _query,
                             FromDate                _fromDate,
                             ToDate                  _toDate)

    {
    if(_fromDate && _toDate)
        _query.dataSourceTable(tablenum(HcmWarehouseHeaderTable),1).addRange(fieldnum(HcmWarehouseHeaderTable, InvoiceDate)).value(queryRange(_fromDate,_toDate));
        return _query;
    }
 private void getReportParameters()
{
    WareHouseReportContract WareHouseReportContract = this.parmDataContract();
        fromDate         = WareHouseReportContract.parmFromDate();
        toDate           = WareHouseReportContract.parmTodate();
}
 // <summary>
/// Executes temporary table.
/// </summary>
/// <returns>
/// The temporary table <c>LedgerJournalTmp</c>.
/// </returns>
[
    SRSReportDataSetAttribute('WarehouseTmp')
]
public WarehouseTmp getWarehouseTmp()
{
    select WarehouseTmp;
    return WarehouseTmp;
}
 private void insertWarehouseTmp(
    HcmWarehouseHeaderTable _HcmWarehouseHeaderTable,
    HcmWarehouseLinesTable _HcmWarehouseLinesTable)
{
    WarehouseTmp.Logo           = _HcmWarehouseHeaderTable.image();
    WarehouseTmp.WarehouseID    = _HcmWarehouseHeaderTable.WarehouseID;
    WarehouseTmp.InvoiceNumber  = _HcmWarehouseHeaderTable.InvoiceNumber;
    WarehouseTmp.InvoiceDate    = _HcmWarehouseHeaderTable.InvoiceDate;
    WarehouseTmp.VendName       = _HcmWarehouseHeaderTable.VendName;
    WarehouseTmp.VendorAccount  = _HcmWarehouseHeaderTable.VendorAccount;
    WarehouseTmp.Address        = _HcmWarehouseHeaderTable.vendorAddress();
    WarehouseTmp.SerialNumber   = _HcmWarehouseLinesTable.SerialNumber;
    WarehouseTmp.ITAssetCode    = _HcmWarehouseLinesTable.ITAssetCode;
    WarehouseTmp.Type           = _HcmWarehouseLinesTable.Type;
    WarehouseTmp.Manufacturer   = _HcmWarehouseLinesTable.Manufacturer;
    WarehouseTmp.Model          = _HcmWarehouseLinesTable.Model;
    WarehouseTmp.ProductDescription = _HcmWarehouseLinesTable.ProductDescription;
    WarehouseTmp.BaseConfiguration  = _HcmWarehouseLinesTable.BaseConfiguration;
    WarehouseTmp.ProductSerialNumber = _HcmWarehouseLinesTable.ProductSerialNumber;
    WarehouseTmp.Quantity       = _HcmWarehouseLinesTable.Quantity;
    WarehouseTmp.AcquisitionCost = _HcmWarehouseLinesTable.AcquisitionCost;
    WarehouseTmp.WarrantyPeriod = _HcmWarehouseLinesTable.WarrantyPeriod;
    WarehouseTmp.insert();
}
 [SysEntryPointAttribute(false)]
public void processReport()
{
    HcmWarehouseHeaderTable HcmWarehouseHeaderTable;
    HcmWarehouseLinesTable HcmWarehouseLinesTable;
    WareHouseReportContract contract;
    QueryRun queryRun;
     this.getReportParameters();
    queryRun = new QueryRun(this.buildQuery(this.parmQuery(),fromDate,toDate));
     while (queryRun.next())
    {
        HcmWarehouseHeaderTable = queryRun.get(tableNum(HcmWarehouseHeaderTable)) as HcmWarehouseHeaderTable;
        HcmWarehouseLinesTable = queryRun.get(tableNum(HcmWarehouseLinesTable)) as HcmWarehouseLinesTable;
        this.insertWarehouseTmp(HcmWarehouseHeaderTable, HcmWarehouseLinesTable);
     }
}
/// <summary>
///    The <c>LedgerJournalContract</c> class is the Data Contract class for the <c>LedgerJournal</c> SSRS
///    report.
/// </summary>
[
    DataContractAttribute,
    SysOperationGroupAttribute('PrintOut', "@SYS12608", '1')
]
public class WareHouseReportContract
{
    TransDate    fromDate;
    TransDate    toDate;
 }
 /// <summary>
/// Gets or sets the value of the datacontract parameter ShowAccrualTrans.
/// </summary>
/// <param name=”_showAccrualTrans”>
/// The new value of the datacontract parameter ShowAccrualTrans; optional.
/// </param>
/// <returns>
///  The current value of datacontract parameter ShowAccrualTrans
/// </returns>
[
    DataMemberAttribute('fromDate'),
    SysOperationLabelAttribute(literalstr("FromDate")),
    SysOperationHelpTextAttribute(literalstr("FromDate")),
    SysOperationGroupMemberAttribute('PrintOut'),
    SysOperationDisplayOrderAttribute('2')
]
public TransDate parmFromDate(TransDate _fromDate = fromDate)
{
    fromDate = _fromDate;
    return fromDate;
}
 // <summary>
/// Gets or sets the value of the datacontract parameter Specification.
/// </summary>
/// <param name=”_specification”>
/// The new value of the datacontract parameter Specification; optional.
/// </param>
/// <returns>
///  The current value of datacontract parameter Specification
/// </returns>
[
    DataMemberAttribute('todate'),
    SysOperationLabelAttribute(literalstr("Todate")),
    SysOperationHelpTextAttribute(literalstr("Todate")),
    SysOperationGroupMemberAttribute('PrintOut'),
    SysOperationDisplayOrderAttribute('3')
]
public TransDate parmTodate(TransDate _todate = todate)
{
    todate = _todate;
    return todate;
}

Regards,

FileNameSplit() to slip the Directory, file name and extension in D365 FnO

 Hi,     /// <summary>     /// Validate the Fileformat     /// </summary>     /// <param name = "filepath">FileP...