SubReport with DataBand Parameters

Stimulsoft Reports.NET discussion
Post Reply
User avatar
pcsiquiero
Posts: 5
Joined: Fri Feb 10, 2017 11:25 am
Location: São Paulo / Brazil

SubReport with DataBand Parameters

Post by pcsiquiero »

I have a main query being listed in the report using the DataBand.
Within the DataBand I include a SubReport to display records of a secondary query with values ​​related to each current record of the DataBand, but I am not able to understand how to pass to the SubReport query the values ​​of the current record of the main query that should be used in the "where" clause of the secondary query.

Example of my two queries:

Code: Select all

-- Main query

SELECT
    typeRegister,
    yearRegister,
    numberRegister,
    (...other columns)
FROM
    myMainTable
WHERE
    (... conditions)


-- For each main query record, I need to list records from a second query using as conditions from that second query, columns from the first query.

SELECT
    column1,
    column2,
    column3,
    (... other columns)
FROM
    mySecondaryTable
WHERE
    typeRegister = @typeRegister -- Value of the current record of the first query
AND yearRegister = @yearRegister -- Value of the current record of the first query
AND numberRegister = @numberRegister -- Value of the current record of the first query
Paulo Siquiero
Developer and Consultant
São Paulo / Brazil
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: SubReport with DataBand Parameters

Post by Alex K. »

Hello,

You can use the ReconnectOnEachRow property for the detail data source.
Please check the sample report in the attachment.

Thank you.
Attachments
ReportSample.mrt
(13.32 KiB) Downloaded 437 times
User avatar
pcsiquiero
Posts: 5
Joined: Fri Feb 10, 2017 11:25 am
Location: São Paulo / Brazil

Re: SubReport with DataBand Parameters

Post by pcsiquiero »

It worked. Thanks.
Paulo Siquiero
Developer and Consultant
São Paulo / Brazil
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: SubReport with DataBand Parameters

Post by Alex K. »

Hello

We are always glad to help you!
Please let us know if you need any additional help.

Thank you.
Post Reply