将Dynamix AX 2012 SRSS PDF报告插入另一个数据库

时间:2021-11-11 07:41:48

I need to insert a PDF report into a linked database upon generation in AX2012. When a user generates the report in AX, a copy needs to be inserted into another database. I am not sure if this is possible. If there are any URLs or links that can point me into the right direction, I would appreciate it.

我需要在AX2012中生成后将PDF报告插入到链接数据库中。当用户在AX中生成报告时,需要将副本插入另一个数据库。我不确定这是否可行。如果有任何URL或链接可以指向正确的方向,我将不胜感激。

1 个解决方案

#1


0  

I would not recommend storing BLOBs directly in another database. Save the data in an AX record first, then transfer it using SSIS or similar.

我不建议将BLOB直接存储在另一个数据库中。首先将数据保存在AX记录中,然后使用SSIS或类似方法进行传输。

Update: I did not notice the SRSS part of you question, the following will only work for old style reports.

更新:我没有注意到您的SRSS部分问题,以下内容仅适用于旧式报告。

The first step is to generate the PDF file, which can be done like in this method, which returns a container to be saved later:

第一步是生成PDF文件,可以像在此方法中一样完成,该文件返回稍后要保存的容器:

client container reportFileCreate(PurchReqQuickId _reqQuickId, Object caller, ReportName reportName)
{
    MenuFunction     mf;
    ReportRun        rr;
    PrintJobSettings pjs;
    Args             args;
    BinData          data;
    #File
    FileName         reportFile = WinAPI::getTempPath() + 'qr' + _reqQuickId + #pdf;
    ;
    new FileIOPermission(reportFile, 'r').assert();

    mf = new MenuFunction(reportName, MenuItemType::Output);
    args = new args(caller);
    args.record(this);

    rr = mf.create(args);
    rr.init();
    rr.report().interactive(false);
    rr.query().interactive(false);

    pjs = rr.printJobSettings();
    pjs.format(PrintFormat::PDF);
    pjs.setTarget(PrintMedium::File);
    pjs.fileName(reportFile);
    pjs.outputToClient(false);

    rr.run();

    data = new BinData();
    data.loadFile(reportFile);
    WinAPI::deleteFile(reportFile);

    return data.getData();
}

#1


0  

I would not recommend storing BLOBs directly in another database. Save the data in an AX record first, then transfer it using SSIS or similar.

我不建议将BLOB直接存储在另一个数据库中。首先将数据保存在AX记录中,然后使用SSIS或类似方法进行传输。

Update: I did not notice the SRSS part of you question, the following will only work for old style reports.

更新:我没有注意到您的SRSS部分问题,以下内容仅适用于旧式报告。

The first step is to generate the PDF file, which can be done like in this method, which returns a container to be saved later:

第一步是生成PDF文件,可以像在此方法中一样完成,该文件返回稍后要保存的容器:

client container reportFileCreate(PurchReqQuickId _reqQuickId, Object caller, ReportName reportName)
{
    MenuFunction     mf;
    ReportRun        rr;
    PrintJobSettings pjs;
    Args             args;
    BinData          data;
    #File
    FileName         reportFile = WinAPI::getTempPath() + 'qr' + _reqQuickId + #pdf;
    ;
    new FileIOPermission(reportFile, 'r').assert();

    mf = new MenuFunction(reportName, MenuItemType::Output);
    args = new args(caller);
    args.record(this);

    rr = mf.create(args);
    rr.init();
    rr.report().interactive(false);
    rr.query().interactive(false);

    pjs = rr.printJobSettings();
    pjs.format(PrintFormat::PDF);
    pjs.setTarget(PrintMedium::File);
    pjs.fileName(reportFile);
    pjs.outputToClient(false);

    rr.run();

    data = new BinData();
    data.loadFile(reportFile);
    WinAPI::deleteFile(reportFile);

    return data.getData();
}