How to show,simple DataTable in calendar report.

Stimulsoft Reports.WEB discussion
Post Reply
soal.sti
Posts: 3
Joined: Fri Jun 16, 2017 2:48 pm

How to show,simple DataTable in calendar report.

Post by soal.sti »

hi
I have a DataTable as a DataSource with just two columns:
1- Date
2- Value (the value of Value column always is 1 for every Row)

Now, I need to show this DataTable like a Calendar, with a count column.
I tried to do this, using "Cross-Tab", "Cross-Data" , and many other ways, but i don't know how to do this.

How to show my DataTable in calendar report ?
Please check attached picture.

thank you
Attachments
Need Help 2.png
Need Help 2.png (26.23 KiB) Viewed 9647 times
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: How to show,simple DataTable in calendar report.

Post by Edward »

Hi Soal,

Please find the two attached sample reports. The DataSource_Next_Method.mrt report is using the standard sample data files: Demo.xsd & Demo.xml as the report data.

The calendar.mrt report shows the approach on how to create a sample calendar report. You mentioned that you have already tried the Cross Bands before. The same approach is used in both the attached reports.

The DataSource_Next_Method.mrt report is using the DataSource.Next() method in the CrossBand.BeforePrint event to move the Categories Data Source to the next row when the id of the current category and the current row match each other's values. The current value of the Categories Data Source is stored into 2 variables id and catName that both have been declared in the report's Dicitionary.

I think using a very similar approach you can build the report you have kindly attached the screenshot of.
CategoriesNext.PNG
CategoriesNext.PNG (57.83 KiB) Viewed 9643 times
Thank you,
Edward
Attachments
DataSource_Next_Method.mrt
(15.31 KiB) Downloaded 376 times
Calendar.mrt
(18.42 KiB) Downloaded 346 times
soal.sti
Posts: 3
Joined: Fri Jun 16, 2017 2:48 pm

Re: How to show,simple DataTable in calendar report.

Post by soal.sti »

Special Thanks, Edward

Your samples were very efficient and I had a good progress to my goal.
But some problems remains:
1- I don't know how to count Red Squares in each line. and show count in Count column in each line , and final line (shown by ???).
2- I don't know how to show Calendar table for each [Pid] (Pid=> Person Id), in each page. In MyDemo.xml, pid for some records is 1, and for some records is 9999. and we need to show one year full calendar for each person in separated pages.
3- I don't know how to change Calendar direction from LTR to RTL
can you help me ?

I attached my sample, Please copy in to "C:Data" Path



Special Thanks
Soal
Attachments
MyDemo.xsd
(1.29 KiB) Downloaded 279 times
MyDemo.xml
(757 Bytes) Downloaded 354 times
MyCalendar.mrt
(17.72 KiB) Downloaded 329 times
Data.zip
(4.08 KiB) Downloaded 227 times
Calendar.jpg
Calendar.jpg (71.51 KiB) Viewed 9640 times
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: How to show,simple DataTable in calendar report.

Post by Edward »

Hi Soal,

Thank you for your detailed explanation and the sample report and the data.

Unfortunately in this case all the calculations and determining the amount of different Pids you need in the report should be calculated before the report is rendered and outside the report.
That should be an additional datasource that is sent to the report dictionary. Once you know how many person details is going to be sent to the report, you need to pass this datasource. You can call it e.g. Persons DataSource.

In the attached report the Databand2 should have this Persons datasource as the source for the data, and not the CountData = 2, which was just to give you an idea on how to calculate that.

For the Right To Left Text Option, please use RightToLeft= true properties of the Text2 component in the report. Also if you need to change the order of days to be 31..1 you also need to handle this 'by hand'.

Please let us know if you have any more questions on this report.

Thank you,
Edward
Attachments
MyCalendar_v1.mrt
(19.31 KiB) Downloaded 412 times
soal.sti
Posts: 3
Joined: Fri Jun 16, 2017 2:48 pm

Re: How to show,simple DataTable in calendar report.

Post by soal.sti »

Dear Edward,

Thanks for your efficient guidance.
Almost all my problems have been solved. But there are only 2 other issues left:

1- For Changing grid direction from LTR to RTL, you said : "use RightToLeft= true properties of the Text2 component in the report", but i can't find RightToLeft properties for Text2. Furthermore, I think Stimulsoft Report Generator needs development to adding option for [docking] cross-bands to Left or to Right.
and after changing [docking] option to Right, all of my grid change direction automatically without any manual configuration, like Right to Left in HTML.
In the other words, after changing to [docking](Or any other word that is considered instead of [docking]) righ, in this sample, the following item arranged from right to left, respectively:
1-CrossHeaderBand1
2-CrossDataBand1
3-CrossFooterBand1

and CrossDataBand1 spread form Right to Left automatically. This is the behavior HTML shows in same times, after changing direction.


2- My Data in previus sample are sorted by Pid and Date in Datasource, otherwise The system will not work properly. To check this problem Change the order of sorted by and see my problem. It is worth mentioning that, in many cases, i'm not sure the data is sorted, And I'm using DataBand sorting feature.
But in this sample, i don't know why sorting does not work properly !

I would like to know your suggestion.

*** I don't know why, when I'm trying to attach files phpBB shows this message: "The extension is not allowed.", I can not attach the files of this example

Thank you,
Soal
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: How to show,simple DataTable in calendar report.

Post by Edward »

Hi Soal,

Please try to zip the files you would like to attach and then they should be attached without an issue. If still for some reason you can not attach the sample file you wanted to share, please send it to support[at]stimulsoft.com.

As for the RightToLeft property of the Text2, please see the screenshot
Right To Left property of the Text2 component
Right To Left property of the Text2 component
RightToLeft.PNG (55.85 KiB) Viewed 9592 times
You are correct, there is no currently support of the Right To Left Direction of the Cross Bands, but there is a workaround you can use. Please sort your data in the reverse direction, i.e. starting from 31..1.
If you use SQL data for the report, it can be easily ordered usning SQL Statements. For XML data in the report the desired sorting can be achieved by using of the Data From Other DataSource data source: https://www.stimulsoft.com/documentatio ... source.htm
There is a 'sort' property of that DataSource, so you can order your data as you need.

The ordering of your data should be done by using the DataSource, not the DataBand, because in the example report above we used 'DataSource.Next()' method to move the current row to the next.
As I mentioned, the report is being rendered manually in that case, that is why moving from row to row in the DataSource is done with help of this manual method.

Thank you,
Edward
Post Reply