Showing posts with label SSRS. Show all posts
Showing posts with label SSRS. Show all posts

Tuesday, June 27, 2017

Deploy SSRS Report through Power Shell

Here is the command to deploy SSRS Report Through Power Shell

Deploy Single Report

 To deploy a specific report, enter the name of the report. For example, to deploy the CustTransList report, enter  the following command:
Command : Publish-AXReport -ReportName CustTransList

Deploy Multiple Report

To deploy two or more specific reports, enter the names of the reports. For example, to deploy the CustTransList and CustTransOpenPerDate reports, enter the following command:
Command : Publish-AXReport -ReportName CustTransList, CustTransOpenPerDate

Deploy All Report

To deploy all reports, enter the following command:
Command  : Publish-AXReport –ReportName 

Deploy Report through x++ code

Here is the code to deploy SSRS report in Microsoft Dynamics AX.

static void deployReport(Args _args)
{
    SRSReportManager srsRptMgr = new SRSReportManager();
    SSRSReportConceptNode node = new SSRSReportConceptNode();

    node = TreeNode::findNode(@"\\SSRS Reports\Reports\SalesInvoice");

    srsRptMgr.deploymentStart();
    srsRptMgr.deployReport(node);
    srsRptMgr.deploymentEnd();
}

Update label description using X++

I have requirement where i need to update label for ssrs report parameter

Here is my solution for updating label

static void updateLabelJob(Args _args)
{
    SysLabelEdit     sysLabelEditLocal;
 
    sysLabelEditLocal = new sysLabelEdit();

    info(strFmt('Before Label changes : %1', "@DAN1"));
 
    sysLabelEditLocal.labelModify('en-us',  sysLabelEditLocal.findLabel('en-us', 'Demo Parameter'),                                                          "SSRSTEST", "", SysLabelApplModule::None);
 
    info(strFmt('After Label changes : %1', "@IQL112"));
}

Synchronization through x++ code / Unable to do DB Sync through AOT

Synchronization forcefully DB through X++ 


here is the code for synchronization DB in X++.

static void DBSync(Args _args )
{
    Dictionary dict;
    int idx,lastIdx,totalTables;
    TableId tableId;
    Application application;
    SysOperationProgress progress;
    StackBase            errorStack;
    ErrorTxt             errorTxt;
    application =  new Application();
    dict = new Dictionary();
    totalTables = dict.tableCnt();
    progress = new SysOperationProgress();
    progress.setTotal(TotalTables);
    progress.setCaption("TEst");
    errorStack = new StackBase(Types::String);
    lastIdx = 0;
    try
    {
        for (idx = lastIdx + 1; idx <= totalTables ; idx++)
        {
            tableId = dict.tableCnt2Id(idx);
            progress.setText(dict.tableName(tableId));

            lastIdx = idx;
            application.dbSynchronize(tableId,false,true,false);
            progress.incCount();
        }
    }
    catch(Exception::Error)
    {
        errorTxt =  strFmt("Error in table '%1 (%2)'",tableId,dict.tableName(tableId));
        errorStack.push(errorTxt);
        retry;
    }

    setPrefix('Test2');
    errorTxt = errorStack.pop();

    while (errorTxt)
    {
        error(errorTxt);
        errorTxt = errorStack.pop();
    }
}

now run job.