Saturday, 30 July 2016

Filtering Data On SSRS Query

Hi,
Below is the sample code written to filter the data based on Query used by report and apply on custom query in DP class;

//DP class
queryVendInvoiceJour=this.parmQuery();
//Get filtered/selected value from standard query
qrOrderAccount = queryVendInvoiceJour.dataSourceName(‘VendInvoiceJour’).rangeField(fieldNum(VendInvoiceJour,OrderAccount));
//Writing custom query based on requirement but applying the selected ranges to custom query
q=new Query();
qbdsVendInvoiceJour = q.addDataSource(tablenum(VendTrans));
qrVendInvoiceJour = qbdsVendInvoiceJour.addRange(fieldNum(VendTrans,AccountNum));
q.dataSourceNo(1).rangeField(fieldNum(VendTrans,AccountNum)).value(qrOrderAccount.value());
qr = new QueryRun(q);

This will help to overwrite the Query used in Report using the custom query by applying same ranges selected by user.

Monday, 25 July 2016



Task Recorder in ax2012:

Task recorder in ax just fallow these steps:
1.       Goto File in Ax workspace:
2.       File > Tools > Task Recorder
3.       Goto settings and parameters

Create a folder in computer and give the path to take the document.

Then you can start the record.

4.       After recording the task it will show the word document in your folder
5.        

A call to the Microsoft Dynamics AX SRSFrameworkService service failed.Expected record type ‘PreambleAck’, found ‘72’..

A call to the Microsoft Dynamics AX SRSFrameworkService service failed.Expected record type ‘PreambleAck’, found ‘72’..


    To Resolve this error, follow these steps:
⦁    Stop the AOS
⦁    Check server configuration


    C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\Bin\XppIL

   
   


      Delete the selected files.

       ⦁    Start the AOS:
       Then the  Application extension files and NETMODULEFile will be re-generated.
      ⦁    Open AOT:
        Services

     






















Refresh the service













Same as SSAS service also.
⦁    Open AOT:
Compile the AOT




⦁    Restart the client
⦁    Run Full CIL
⦁    Run Incremental CIL
⦁    Try deploy the report. It will work.


Friday, 24 June 2016

Importing Image from resource node and exporting the same to excel



Importing Image from resource node and exporting the same to excel:


The below is the job to export image from AX to excel file.
static void ExportImageToExcel(Args _args)
{
    COM comApplication;
    COM comWorkbooks;
    COM comWorkbook;
    COM comWorksheet;
    COM comShapes;

    COMVariant variant = new COMVariant();
    COMVariant xpos = new COMVariant();
    COMVariant ypos = new COMVariant();
    COMVariant state = new COMVariant();
    COMVariant width = new COMVariant();
    COMVariant height = new COMVariant();

    SysExcelWorksheet excelWorksheet;
    SysExcelCells excelCells;
    ;

    //Create the Excel app and grab the workbooks
    comApplication = new COM('Excel.application');
    comWorkBooks = comApplication.workbooks();

    //Wrap the rest in an exception to make sure excel is closed
    try
    {
        //Create a new workbook and get a reference to it
        variant.int(-4167);
        comWorkBook = comWorkBooks.add(variant);
        comWorkSheet = comApplication.activeSheet();
        //Add some text to the worksheet
        excelWorksheet = SysExcelWorkSheet::construct(MSOfficeVersion::Office2007, comWorksheet);
        excelCells = excelWorksheet.cells();
        excelCells.item(10,1).value("Hello world");

        //Set up image parameters
        variant.bStr("c:\\temp\\photo.jpg");
        xpos.int(1);
        ypos.int(1);
        state.int(1);
        width.int(100);
        height.int(100);
        //Add the image to the worksheet
        comShapes = comWorkSheet.shapes();
        comShapes.addPicture(variant,xpos,ypos,state,state,width,height);

        //Autofitt and protect the sheet
        excelworksheet.columns().autoFit();
        excelWorksheet.protect('',true,true);

        //Save the sheet and close the app
        comWorkBook.saveas("c:\\temp\\hello.xls");
        comWorkBooks.close();
        comApplication.quit();
    }
    catch(Exception::Error)
    {
        //Force app to quit
        comWorkBook.saveas("c:\\temp\\hello.xls");
        comWorkBooks.close();
        comApplication.quit();
    }
}


The logo in my example I have kept in the path C:\\Temp\image.png and from that path image will be taken by AX and export it to the excel file in the same folder temp.

 


Output:



Repeat the heading to the next page in SSRS Reports: To repeat the table header in the next page, follow these steps: ⦁    Open the repo...