Export Report with Parameters

Posted by: andy.beaulieu on 5 December 2018, 4:58 pm EST

    • Post Options:
    • Link

    Posted 5 December 2018, 4:58 pm EST

    Is there some sample code for exporting a report with Parameters? (It looks like all of the included SDK samples say “Parameterized Reports are not supported”)

    I would like to use the REST API /api/reports/{id}/jobs/render

    It works fine with no parameters, or one simple parameter. But when I am trying more complicated reports, I always get an HTTP 500 returned, with no logged error or more details.

    Here is an example of what I’m posting, which I think adheres to the spec?

    
    {
      "ReportParameters": [ 
        {
          "Name": "parm1",
          "Domain": "SpecifiedValues",
          "Values": [ "5" ]
        },
        {
          "Name": "parm2",
          "Domain": "SpecifiedValues",
          "Values": [ "" ]
        },
        {
          "Name": "parm3",
          "Domain": "SpecifiedValues",
          "Values": [ "-1" ]
        }
      ],
      "ExtensionName": "PDF",
      "ExtensionSettings": {
        "Application": "ActiveReports Server",
        "Author": "ActiveReports Server",
        "OptimizeStatic": true,
        "PrintOnOpen": true,
        "NeedExportSupport": true
      },
      "Timeout": 20000,
      "UseCache": false
    }
    

    Thanks!

  • Posted 6 December 2018, 1:09 am EST

    Hello,

    Sorry to mention that I unable to replicate the issue at my end. I am using the same Post API (/api/reports/{id}/jobs/render) with the following data

    
    {
      "ReportParameters": [ 
        {
    "Name": "ReportParameter",
    "Domain": "SpecifiedValues",
    "Values": ["Rock"]
    },
        {
    "Name": "ReportParameter1",
    "Domain": "SpecifiedValues",
    "Values": ["Accept"]
    },
       {
    "Name": "ReportParameter2",
    "Domain": "SpecifiedValues",
    "Values": ["Restless and Wild"]
    }
    
      ],
      "ExtensionName": "PDF",
      "ExtensionSettings": {
        "Application": "ActiveReports Server",
        "Author": "ActiveReports Server",
        "OptimizeStatic": true,
        "PrintOnOpen": true,
        "NeedExportSupport": true
      },
      "Timeout": 20000,
      "UseCache": false
    }
    
    

    The report is successfully exported to PDF format. Could you please try with the above data with inbuilt sample report “Cascading Prompts Example”.

    Also, if possible, could you please send the report(that can run at my end). So that I can replicate the issue at my end.

    Thanks,

  • Posted 6 December 2018, 10:17 am EST

    Yup, it works… I think the exception was because of bad parameter values (dates were “Unspecified”)

    {
      "Name": "date",
      "Domain": "SpecifiedValues",
      "Values": [ "Unspecified" ]
    },
    

    It would be handy if the AR Server log provided some details on exceptions like this.

    Also a note on the docs:

    The doc here - http://help.grapecity.com/activereports/webhelp/AR12ServerAPI/index.html#!/reports/post_api_reports_id_jobs_render

    … says …

    [i]For more you can see AR documentation http://arhelp.grapecity.com/webhelp/AR11/index.html#Rendering.html.[/i]

    … but that link appears to go nowhere.

    Thanks!

  • Posted 11 January 2019, 4:25 am EST

    Hello,

    I will send this suggestion to our higher team(ID 268373). Also, please refer the following correct link:

    http://help.grapecity.com/activereports/webhelp/AR12/webframe.html#Rendering.html

    Sorry for the inconvenience caused.

    Thanks.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels