Updaing parameters of report2 from those chosed in report1

  • 3p
    azoccolillo3p 2 months, 1 week ago

    I’m running an MVC HTML5 Viewer showing 3 reports. All 3 reports have the same parameters. I default the page to the first report with default parameters. If I change parameters on Report1 and then click on Report2, the parameters for Report2 come in as the default parameters. I want Report2 to pick up the parameter changes on Report1 and use them on Report2.

    Any ideas an the best way to do this? Should I set some session variables and assign then on click of the report or View Report? Then pick them up and assign them on the next report selected?

    Thanks,

  • 189p
    AbdiasM189p 2 months, 1 week ago

    I’m sorry there’s no direct way to get the parameter’s changed value on the client side to store and use it in Report2. The only way is to get the parameter textbox from the DOM and access its value like below:

    $(".param-value").find(".form-control").eq(0).val()

    You could then set this as the value of the parameter in Report2 as below:

    var reportOption = {
                        id: 'Reports/Report2.rdlx',
                        parameters:[
                            {
                                name: 'Param1',
                                value : 'value'
                            }
                        ]
                    };
  • 3p
    azoccolillo3p 2 months ago

    Is there a way to disable the report parameter and search sidebar?

    If I added my own parameter DIV I could feed each report this “universal” parameter set from the DOM in javascript load function. If I did this I don’t want the default report parameter window to be viewable.

  • 189p
    AbdiasM189p 2 months ago

    For Page/RDL Report, you can check the Hidden property of the Parameter and it won’t show in the Parameter pane and for SectionReport, you can set the PromptUser property to False to hide it. You can then provide the value of this parameter from the ‘universal’ parameter using the code in my previous response.

    I hope it helps clarify.

  • 3p
    azoccolillo3p 1 month, 3 weeks ago

    I was able to do this by taking the parameters outside the viewer and passing them in via javascript on click of the report name.

    I added a panel with my parameter input using Mvc.CascadingDropdownList (on GitHib here https://github.com/alexanderar/Mvc.CascadeDropDown). I then modified my button change script…

    // Set up buttons to change reports
    var reportsButtons = $(‘#btnReport button’);
    reportsButtons.bind(‘click’, function (ev) {
    //alert(“reportsButtons.bind”);
    ev.stopImmediatePropagation();
    reportsButtons.removeClass(‘active’);
    var target = $(ev.target);
    target.addClass(‘active’);
    var reportOption = {
    id: target.attr(‘data-bind’),
    parameters:[
    {name: "year"},
    {name: "period"},
    {name: "dept"},
    {name: "account"}
    ]
    };
    //add a comma between selected values
    var SelectedAccountVal = $(‘Select#SelectedAccount’).val();
    var selectedAccounts = “”;
    if (SelectedAccountVal != null) {
    $.each(SelectedAccountVal, function (index, value) {
    selectedAccounts = selectedAccounts + value + “,”;
    });
    };
    //remove the trailing comma
    selectedAccounts = selectedAccounts.substring(0, selectedAccounts.length – 1);
    reportOption.parameters[0].value = $(“#SelectedYear option:selected”).text();
    reportOption.parameters[1].value = $(“#SelectedPeriod option:selected”).text();
    reportOption.parameters[2].value = $(“#SelectedDept option:selected”).text();
    reportOption.parameters[3].value = selectedAccounts;

    reportsButtons.prop(‘disabled’, true);
    viewer.option(‘report’, reportOption);
    });

    On my reports I set all parameters hidded and for the multiselect parameter I unchecked multiselect and set no available or default values.
    In my script I form the multiselect parameter as text1,text2,text3 etc with no quotes.
    In my SQL I use a split function …
    AND (CTDESC IN (SELECT Value FROM fn_Split(@accounts, ‘,’)) OR ( LEFT(@accounts,8) = ‘Show All’))
    Split function found here

    http://stackoverflow.com/questions/16872056/how-to-pass-string-parameter-with-in-operator-in-stored-procedure-sql-server-2

    …and it works. I can set my parameters in a panel and click on report1, switch to report2 using the same parameters.

    I have the parameters in a panel that I can toggle visible. Now I need to make the panel slide out left to right with the report viewer next to it.

    Attachments:
    1. Capture

      Capture.jpg

  • 189p
    AbdiasM189p 1 month, 3 weeks ago

    Thanks for sharing your solution with us. I’m glad to know you were able to find a solution for the requirement. Regarding toggling the parameters panel, you could use the jQuery panel and toggle it using show and hide methods. You could find more info here -

    https://forums.asp.net/t/1805123.aspx?sliding+toggling+panel+horizontally+left+and+right

  • 3p
    azoccolillo3p 1 month, 3 weeks ago

    @AbdiasM said:
    Thanks for sharing your solution with us. I’m glad to know you were able to find a solution for the requirement. Regarding toggling the parameters panel, you could use the jQuery panel and toggle it using show and hide methods. You could find more info here -

    https://forums.asp.net/t/1805123.aspx?sliding+toggling+panel+horizontally+left+and+right

    Yes, that is exactly what I used to toggle the parameter panel, but it’s a top to bottom expansion. I was going to try to get a left side expand to right and shift shrink to viewer panel to accommodate the param panel expansion, similar to how the viewers search/param panel work. But ended up putting the patameters into 2 columns and it looks good and works well…so I think I’m done.

    Attachments:
    1. Capture1

      Capture1.jpg

  • 189p
    AbdiasM189p 1 month, 3 weeks ago

    Happy to know that you have everything setup as per your requirements. Do let us know if you need any other help with ActiveReports.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.