How to dynamically update Databand-Queries

Stimulsoft Reports.NET discussion
Post Reply
JGO293
Posts: 4
Joined: Wed Apr 02, 2025 9:19 am

How to dynamically update Databand-Queries

Post by JGO293 »

Hello,
what am i trying:
I have a databand A which runs through IDs and another databand B which has databand A as a main component and i want Databand Bs Query to be dynamically changed according to the ID in Databand A.

Example:
I have 3 Departments with 10 different people attached to them and the report should look like this:

Code: Select all

Department A
	Person of Department A 1
	...
	Person of Department A 10
Department B
	Person of Department B 1
	...
	Person of Department B 10
Department C
	Person of Department C 1
	...
	Person of Department C 10

I have successfully created a variable "DepartmentKey" that changes to the ID of the current department in the Before Print Event of the Person-Databand. And the query of person objects looks like this SELECT Name FROM Person WHERE Department = @DepartmentKey
But the person Databand does not update its data and prints the same list of person objects per department, it looks like the query is evaluated with the start parameter once and then printed per department

Is there a way to make this happen with different components or am i overlooking something?

Note: This case is a simplifaction of my original problem, so changing the report to a single databand with a single query and running a group component for the departments will not work due to the database structure i am working with
Lech Kulikowski
Posts: 7332
Joined: Tue Mar 20, 2018 5:34 am

Re: How to dynamically update Databand-Queries

Post by Lech Kulikowski »

Hello,

Please send us a sample report with test data that reproduces the issue for analysis.

Thank you.
JGO293
Posts: 4
Joined: Wed Apr 02, 2025 9:19 am

Re: How to dynamically update Databand-Queries

Post by JGO293 »

Hello,
the report editor i use at my work is built into a bigger software, which does not let me export or save reports as files.
I have managed to recreate the report in the online editor but with a trial membership i cannot share the file.

Is there another way to get the report in a shareable format?
Otherwise i can send the configuration of my report with text and screenshots as the problem was quite simple to recreate
Lech Kulikowski
Posts: 7332
Joined: Tue Mar 20, 2018 5:34 am

Re: How to dynamically update Databand-Queries

Post by Lech Kulikowski »

Hello,

Ok. Try to send screenshots for analysis.

Thank you.
JGO293
Posts: 4
Joined: Wed Apr 02, 2025 9:19 am

Re: How to dynamically update Databand-Queries

Post by JGO293 »

Hello,

This is the report i have configured:
ReportOverview.png
ReportOverview.png (338.08 KiB) Viewed 12699 times
Databand1 has sampleDepartments as a Data Source, the rest is configured by default
Databand2 has samplePersons as a Data Source, Databand1 as a Master Component and the Filter is configured like this:
"Expression -> samplePersons.Department == DepartmentOfPerson"
(The middle Text component is cut off in the overview screenshot but says "Department of Person: {samplePersons.Department}"

The Before Print Event of Databand2 looks like this:
DB2_PrePrint_Event.png
DB2_PrePrint_Event.png (27.86 KiB) Viewed 12699 times
The variable i change here is defined as this:
Variable_DepartmentOfPersons.png
Variable_DepartmentOfPersons.png (57.31 KiB) Viewed 12699 times
The Data itself is also attached here as csv files


Let me know if this is sufficient information on my report or if you need any other information, then i can provide whatever is necessary

Thank you
Attachments
samplePersons.csv
(167 Bytes) Downloaded 104 times
sampleDepartments.csv
(56 Bytes) Downloaded 108 times
Lech Kulikowski
Posts: 7332
Joined: Tue Mar 20, 2018 5:34 am

Re: How to dynamically update Databand-Queries

Post by Lech Kulikowski »

Hello,

On your screenshots CSV data sources (files), what query do you want to call for B databand?

For the SQL sources, there is the ReconnectOnEachRow option that allows running queries for each line of the databand.

Thank you.
Attachments
Screenshot 2025-04-14 230330.png
Screenshot 2025-04-14 230330.png (46.16 KiB) Viewed 6140 times
JGO293
Posts: 4
Joined: Wed Apr 02, 2025 9:19 am

Re: How to dynamically update Databand-Queries

Post by JGO293 »

Hello,
thank you for the hint, I will try that as soon as possible
Lech Kulikowski
Posts: 7332
Joined: Tue Mar 20, 2018 5:34 am

Re: How to dynamically update Databand-Queries

Post by Lech Kulikowski »

Hello,

You are welcome.
Post Reply