Combine two datasoure/datatable into one datatable

Stimulsoft Reports.NET discussion
Post Reply
User avatar
zalak
Posts: 18
Joined: Wed Jun 20, 2018 1:41 pm

Combine two datasoure/datatable into one datatable

Post by zalak »

Hello,

I am new to Stimulsoft and I need to create simple bar graph with one extra bar for showing the average value.
(I have attached an image showing what should be the expected output)

About DataSoure:
There is one main DataSource coming from the application from which I want to create a new datasource for the chart. I need to create this new datasource using User Interface and NOT by coding.

GraphTable: The simplest DataTable I could create from main DataSource is something like this
Year Quantity
2014 1
2015 1
2016 2
2017 1
2018 2

In order to show the average bar I need to add one more row to this DataTable (GraphTable) with values as Year => Average & Quantity => 1.2.
Is there a way I can add one more row to this table?

Or

I created another DataTable "AvgTable"
Year Quantity
Average 1.2

Now, Is there a way I can combine the above two tables into one datatable?

Thanks & Regards,
Zalak
Attachments
ExpectedOutput.png
ExpectedOutput.png (15.69 KiB) Viewed 1749 times
ExpectedOutput.png
ExpectedOutput.png (15.69 KiB) Viewed 1750 times
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Combine two datasoure/datatable into one datatable

Post by HighAley »

Hello.

You can add additional series and show such bar.
You could add a Constant Line.
Please, look at the attached report.
We use a variable and some code in events.

Thank you.
Attachments
AverageOnChart.mrt
(24.55 KiB) Downloaded 129 times
User avatar
zalak
Posts: 18
Joined: Wed Jun 20, 2018 1:41 pm

Re: Combine two datasoure/datatable into one datatable

Post by zalak »

Hello,

Thank you for your reply. What do you mean by "code in events"? can you give me example and where to write it? Is it like writing an expression?

Also, if I add additional series for showing Average it does not show as a separate bar but either stacked on series 1(Stacked column) or adjacent to series 1(Clustered column).

Thanks & Regards,
Zalak Dobaria
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Combine two datasoure/datatable into one datatable

Post by HighAley »

Hello.

There is a code on the Before Print event of the DataBand and Footerband.
To see it you should select it and open events list.
Events (2).png
Events (2).png (10.68 KiB) Viewed 1698 times
Thank you.
User avatar
zalak
Posts: 18
Joined: Wed Jun 20, 2018 1:41 pm

Re: Combine two datasoure/datatable into one datatable

Post by zalak »

Hello,

Thank you so much for the details, I had no idea about Events in report designer :o .
Will work around with this and see if I can get required results.

Thank you once again.

Regards,
Zalak Dobaria
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Combine two datasoure/datatable into one datatable

Post by HighAley »

Hello, Zalak.

We are always glad to help you.
Let us know if you need additional help.

Thank you.
Post Reply