logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
scott9677  
#1 Posted : Monday, February 25, 2019 8:51:36 PM(UTC)
scott9677

Rank: Advanced Member

Groups: Registered
Joined: 5/18/2018(UTC)
Posts: 40

Thanks: 2 times
I have a nifty T-sql statement that I have come up with that allows you to enter a date range and it will use a SQL Server pivot to generate a report with the columns being the year-month and the rows being the sum of some data.

For instance, something like this if you pass in January 2018 to March 2018:

Sales

Type 2018-01 2018-02 2018-03
Net 10000 500 2500
Gross 12000 1000 3500


Is there a way to feed this into a Seal Report and be able to generate a report and a graph?

I'd also like to do it as a join of two results, one with the sums and the other with the counts.

I currently have the query in as a stored procedure.
epf  
#2 Posted : Wednesday, February 27, 2019 9:12:40 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
If you do not have performances problem, you should create views that contains the SQL of the Pivot and load its definition into a data source.
Same remark for the other 2 results: just create views based on their SQL and define the joins.

If you are not allowed to create view, you can also cut/paste the SQL directly in the table defintion of the source. In this case, the Seal Report engine with use it as "select * from (your SQL) aliasName" to define a table named aliasName.

If you have performances problem and want to wait for the user input before, another approach is to us the report tasks to create a temporary through an SP for example.
In the forum, you have also some posts and samples to query a table from ma stored procedure.

Good luck.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.