Sorting by condition or BeforePrint event
-
- Posts: 19
- Joined: Tue Jan 06, 2015 7:39 pm
Sorting by condition or BeforePrint event
Hi there,
Is there a way to set the sorting property of a data band by a condition based on another property informed in a second Dictionary (query)?
Ex:
A report listing clients.Id, clients.Name and clients.PhoneNumber from the "clients" Dictionary, obviously. But I have a second Dictionary named "filter", with a single property of type int, called sortBy.
So, if filter.sortBy == 1, data band will sort by Id, sortBy == 2 data band will sort by name, and if sortBy == 3 it would sort by PhoneNumber.
I had solved this by another way, doing a switch/case orderBy in the query, on beforePrintReport event, and disabling any sorting of GroupHeaderBands, but I really would like to know if its possible of doing inside stimulsoft's, like using BeforePrint event on the data band or something like that.
Thanks in advance!
Is there a way to set the sorting property of a data band by a condition based on another property informed in a second Dictionary (query)?
Ex:
A report listing clients.Id, clients.Name and clients.PhoneNumber from the "clients" Dictionary, obviously. But I have a second Dictionary named "filter", with a single property of type int, called sortBy.
So, if filter.sortBy == 1, data band will sort by Id, sortBy == 2 data band will sort by name, and if sortBy == 3 it would sort by PhoneNumber.
I had solved this by another way, doing a switch/case orderBy in the query, on beforePrintReport event, and disabling any sorting of GroupHeaderBands, but I really would like to know if its possible of doing inside stimulsoft's, like using BeforePrint event on the data band or something like that.
Thanks in advance!
Re: Sorting by condition or BeforePrint event
Hello.
You can set the Sort property in the Begin Render property.
How to set the Sort property you could read in the article from the Stimulsoft Knowledge Base.
Thank you.
You can set the Sort property in the Begin Render property.
How to set the Sort property you could read in the article from the Stimulsoft Knowledge Base.
Thank you.
-
- Posts: 19
- Joined: Tue Jan 06, 2015 7:39 pm
Re: Sorting by condition or BeforePrint event
Thanks Aleksey, but where should I put that C# code? I mean, from where should I access the BeginRender property like that?
Re: Sorting by condition or BeforePrint event
Hello,
You can use this code in the BeginRender or BeforePrint events.
Thank you.
You can use this code in the BeginRender or BeforePrint events.
Thank you.
-
- Posts: 19
- Joined: Tue Jan 06, 2015 7:39 pm
Re: Sorting by condition or BeforePrint event
I just needed to switch the "report." to "this.", because it didn't recognized my report name. But it worked. Thank you! That was very helpfull!
Re: Sorting by condition or BeforePrint event
Hello,
We are always glad to help you!
Let us know if you need any additional help.
Thank you.
We are always glad to help you!
Let us know if you need any additional help.
Thank you.