This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to read a parameter value in Sub reports

Hi,

I have a custom report. It will get user input From and Todate to generate the report with in that dates. I used a parameters to get the date.

In the summery Page, i can able to refer the Parameter ( DateFrom and DateTo). If i refer the parameter variable in the sub reports ( Pending Attestation , Completed Attestation) , it return the default date value. It does not get the data entered by the user when generating the report. lt looks like the it is not the global value which can be used in sub reports.

I want to show the From and To data user entered in the Parameter when generating the Report in Sub Reports.

How can i achieve this. Can some one help me on this?

  • I tried to access the parameters in the SubReport using the standard notation {DateFrom} or {DateTo} and it worked in my tests.

    The parameters should appear in the report dictionary in the variables section.

    You may need to describe your problem in more detail if this is still not working in your environment. It is always good to know the version you are using for example.

    HtH
  • Hi Markus,

    I used same notation also but it return the default value which we provided in the parameter sections. if i remove the default date, i get database default date. The version I am using is Q1IM 6.1.3. Pease find the screenshot.

     

    Report - Parameters

     

    Summery Report shows correct date entered by user.

     

    Sub Report with default date. Not the actual date entered by user.

  • I've built a sample in 6.1.3 and it's working as it should be.

    I've attached my sample report as transport so that you can compare what I might have done differently.

    I've tested the parameter query function using a subscribable report based on the sample report I've created.

    Hth

    6165.Transport_MSSQL_Sample Report fĂĽr Parameters in Sub Reports.zip

  • Hi Markus,

    I have tested your report. In the parameter i found difference, your are using query. I am using fix. i changed that to query. But still not working.

    My report opens the new page when user click "Pending attestation" in the summery page. Your report shows sub report in the same page.

  • In your sample, the select value for the parameter DateFrom is displayed on the sub report.

    Just the parameter DateTo is displaying the default value because you haven't specified a value. Again the parameter is displayed the same on the main and the sub report what is different to your original problem description.

    Next question would be, how you open the report. I assume you create a custom form to do that. It would be helpful if you post the configuration XML for that report form.

     

  • Hi Markus,

    Date in Overview Page is reflecting the date provided in the From text.

     

    Once i click Approved in the overview page. Another Page opens with All the approved users. Date is not correct.

    I have attached mrt file for your reference.ADP_Attestation_New.txt

  • Thanks for the MRT file. But what I still need is the answer to the question about how you open the report.

    I assume you create a custom form to do that. It would be helpful if you post the configuration XML for that report form. I still think that the reason for that behavior is related to the way you open the report.

     

  • Hi Markus,

    Please find the configuration of the form. i am opening the report in the Manager. I will select the Attestation , then click the Overview report of the Attestation Policy.


    <DialogSheetDefinition FormatVersion="1.0">
    <SpecialSheetData>ADP_Attestation_OverView New|AttestationPolicy=%UID_AttestationPolicy%</SpecialSheetData>
    <Properties>
    <Property Name="UseDateSelection">True</Property>
    <Property Name="From" Format="dd-MMM-yyyy">DateFrom</Property>
    <!--Default: DateFrom -->
    <Property Name="To" Format="dd-MMM-yyyy">DateUntil</Property>
    <!-- Default: DateTo -->
    </Properties>
    </DialogSheetDefinition>
  • I looked at the report definition file you send me and you used drill-down of the report engine to open the sub-report defined on different pages in the same report using event code.

    For drill-downs the report engine allows you to define additional drill-down parameters. You have to give them a name and define an expression.

    In you case create parameters for datefrom and dateuntil and set the expression to the value of the dictionary variables DateFrom and DateUntil.

    Your event code for defining the parameters should similar to the following (new lines highlighted, just one sample use case):

    You can reference the DrillDownParameters in the sub-report using this["<Name>"]. In my sample this would be this["DateFromSub"].

    https://www.stimulsoft.com/en/documentation/online/user-manual/index.html?report_internals_interaction_drill-down_parameters.htm

    https://www.stimulsoft.com/en/documentation/online/user-manual/index.html?getting_started_invoice_report_with_parameters.htm

    HtH

  • Hi Markus,

    I have updated the event code like below. But i am not able to refer the value in the sub-report by ["DateFromSub"]. it return DataFromSub not the value of it.

    {
    if (e.Value == "Pending"
    && ((StiText)sender).Interaction.DrillDownPage == null)
    {
    //SubReportAttestationPending.Enabled=true;
    ((StiText)sender).Interaction.DrillDownEnabled = true;
    ((StiText)sender).Interaction.DrillDownPage = SubReportAttestationPending;
    StiComponent comp = sender as StiComponent;
    comp.DrillDownParameters = new System.Collections.Generic.Dictionary<string, object>();
    // CheckerInfo: DrillDownParameter1 txtStatus

    comp.DrillDownParameters.Add("DateFromSub", DateFrom);
    comp.DrillDownParameters.Add("DateUntilSub", DateUntil);

    }
    else if (e.Value == "Approved"
    && ((StiText)sender).Interaction.DrillDownPage == null)
    {
    //SubReportAttestationApproved.Enabled=true;
    ((StiText)sender).Interaction.DrillDownEnabled = true;
    ((StiText)sender).Interaction.DrillDownPage = SubReportAttestationApproved;
    StiComponent comp = sender as StiComponent;
    comp.DrillDownParameters = new System.Collections.Generic.Dictionary<string, object>();
    // CheckerInfo: DrillDownParameter1 txtStatus

    comp.DrillDownParameters.Add("DateFromSub", DateFrom);
    comp.DrillDownParameters.Add("DateUntilSub", DateUntil);

    }
    else if (e.Value == "Denied"
    && ((StiText)sender).Interaction.DrillDownPage == null)
    {
    //SubReportAttestationApproved.Enabled=true;
    ((StiText)sender).Interaction.DrillDownEnabled = true;
    ((StiText)sender).Interaction.DrillDownPage = SubReportAttestationDenied;
    StiComponent comp = sender as StiComponent;
    comp.DrillDownParameters = new System.Collections.Generic.Dictionary<string, object>();
    // CheckerInfo: DrillDownParameter1 txtStatus

    comp.DrillDownParameters.Add("DateFromSub", DateFrom);
    comp.DrillDownParameters.Add("DateUntilSub", DateUntil);

    }
    }