How to include parameters in initial report viewer load?

Posted by: rico on 8 April 2024, 5:36 am EST

  • Posted 8 April 2024, 5:36 am EST - Updated 8 April 2024, 8:56 am EST

    I am using the react Wijmo report viewer, with the C1 WebAPI on the backend and finding it impossible to get the report to load with parameters I specify in the parameters object.

  • Posted 8 April 2024, 11:16 pm EST - Updated 8 April 2024, 11:21 pm EST

    Hi Rico,

    Sorry, but we are unable to replicate the issue on our end, we will need some more details regarding this issue from your end. First of all, please make sure that the parameters you are setting are in the correct syntax and match the parameters accepted values criteria on the server side. Please refer to the attached sample for your reference. You’ll find the accepted values criteria in the attached screenshot for the attached sample.

    If the issue still persists, then please share some code snippets of how you are setting the parameters and what are the parameters used. If there are any console errors, please attach the error screenshots as well. It would be really helpful if you could share a small sample in which the issue can be replicated if possible.

    Note: Please use ‘npm install --force’ command to install the required packages in the attached sample.

    Regards

    reportViewer_react_parameters.zip

  • Posted 10 April 2024, 10:21 am EST

    Thanks for the sample, I was able to figure out the issue. Can you also point me in the right direction to handle failed XHR requests? For instance if the report server is not available, how can I catch that and display something friendly to the user ?

  • Posted 10 April 2024, 9:08 pm EST

    Hi Rico,

    You can handle the ‘beforeSendRequest’ event of the ReportViewer and override the default error function of the XHR request, to get notified when a error is occurred and to show a message to the user about the error. Please refer to the following code snippet -

    function beforeRequest(s, e) {
            let errorFun = e.settings.error;
            e.settings.error = (error) => {
                //invoke default error fun
                errorFun.call(this, error);
    
                // your custom implementation for error handling
                console.log('Error occurred : ', error)
                alert('Some error occurred on Server-side')
            }
        }

    Please refer to the attached sample for the same. In the attached sample, we have changed the reportName from ‘MultivalueParameters’ to ‘MultivalueParameter’, so that the error handling can be tested.

    Regards

    reportViewer_errorHandling.zip

Need extra support?

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

Learn More

Forum Channels