Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic New to reporting. (Read 2240 times)
Dom@Hadley
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Oct 5th, 2017
New to reporting.
Jan 29th, 2018 at 11:34am
Print Post  
Hi

I'm evaluating the Reporting tool for use in our application and we have currently purchased the scheduling tool for WPF. 
I've been through the help file for reporting and see there are two ways to use it.  We've opted not to link it directly with the Schedule as this would cause an additional overhead.  What I really want to know, which is not clear in the examples, is for each set of data I must set up a datarange with a header and footer.  E.g. if I am printing a plan of the schedule and we have three resources in the schedule, how can I separate each resource onto a separate page within the report?
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: New to reporting.
Reply #1 - Jan 29th, 2018 at 1:44pm
Print Post  
Hi,

A sample demonstrating how to integrate the Reporting for WPF with the Scheduling for WPF can be downloaded from the link below:

http://mindfusion.eu/_samples/_sample_WpfReportingPlannerIntegration.zip

The sample demonstrates a simple report bound to a Schedule. The report lists the resources in the bound schedule in a master data range and the items under each resource in a nested data range. You can play around with the report to extend it. If you have additional questions, I will be happy to assist.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Dom@Hadley
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Oct 5th, 2017
Re: New to reporting.
Reply #2 - Jan 29th, 2018 at 4:23pm
Print Post  
Hi Meppy
Many thanks for your example but this example ties it to the schedule which we cannot do. Our schedule resources and calendar items are too basic for the report we want to build. Our data dictionary comes from the database not the schedule. Each single appointment has a list of data in the database that is not in the Calendar Item. I hope you understand.
Cheers
Dom
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: New to reporting.
Reply #3 - Jan 30th, 2018 at 7:22am
Print Post  
Hi,

The purpose of the sample is to illustrate how to bind the report to a data source. You can extend it with a data source different than the schedule. If you provide me with more information about your data source, I can help you extend the report to accommodate it.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Dom@Hadley
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Oct 5th, 2017
Re: New to reporting.
Reply #4 - Jan 31st, 2018 at 12:56pm
Print Post  
Hi Meppy

My datasource is an observablecollection of custom object which is from a sql server View using EntityFramework. The view returns a full list of all the details of the plan for the day chosen by the user. There are four resources on each day (currently) and each work request (appointment) contains multiple work orders. The report is to provide a list of work orders for the day for each resource. The database resources are tied to the Schedule's Resources by Id.
Many thanks
Dom
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: New to reporting.
Reply #5 - Feb 1st, 2018 at 9:03am
Print Post  
Hi,

Here is how you should modify the existing sample to accommodate it to your scenario:

1. Leave the DataContext of the report as is, i.e.:

Code
Select All
report.DataContext = calendar.Schedule.Resources; 


This is to ensure that the report lists the work orders for the day grouped by resource.

2. Rename the ItemsRange in ListBoundReport.xaml to OrdersRange to indicate that this data range will now show orders, rather than appointments.

3. In the Report.QueryDetails event handler, check if the DataRange being populated is the OrdersRange. Then obtain the Resource whose orders are being queried through the MasterRow property of the event argument. Finally, assign the Details property of the event argument to an enumerable of all orders associated with this resource for the respective day. For example, you can do this by using Linq on the EntityFramework object representing the list of work orders for the respective day:

Code
Select All
report.QueryDetails += (s, e) =>
{
	DataRange sender = s as DataRange;
	if (sender != null)
	{
		if (sender.Name == "OrdersRange")
		{
			var resource = e.MasterRow as Resource;
			e.Details = orderCollection.Where(order => IsAssociatedWithResource(order, resource));
		}
	}
}; 


The above code assumes that orderCollection is a list/enumerable of all work orders for the day and that IsAssociatedWithResource method returns true if the specified order belongs to the specified resource. The implementation of this method depends on how your orders are associated with the resource.

4. Finally, modify the DataRange.ItemTemplate of the ItemsRange data range in ListBoundReport.xaml to include the desired fields of the work order in the report. Currently this ItemTemplate contains a single label, bound to the HeaderText of an appointment. Now that we are binding to work orders, you should modify the ItemTemplate accordingly.

I hope this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Dom@Hadley
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Oct 5th, 2017
Re: New to reporting.
Reply #6 - Feb 1st, 2018 at 3:10pm
Print Post  
Thanks  Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint