Building Data Rich Reports in a Snap (with Snap for WinForms)

DevExpress Data Blog
24 July 2013

Building top notch reports is hard; but not because building reports is a difficult task. The fact of the matter is that report building is often fraught with a set of miniscule tasks spread over a large amount of time. “Can you change the font….?” “I’m not sure that is the appropriate shade of red.” “How hard can it be to make a new report?”

With Snap for WinForms we can finally say “Sure! You do it.” We’ve recently even added two features that should make the process of offloading this task to your end users:

  1. Nested Fields
  2. Data Source Wizard

Nested Fields

One of the best UX design principles when it comes to managing data is the notion that we should only expose exactly what is necessary for the task at hand and allow the end user to drill in to more complex functionality as needed. This is especially true of the Field List. Often users are presented with something like this:

Long Field List

While not necessarily too cumbersome it is often useful to compartmentalize the data: in other words, create a hierarchy of fields such as this:

Nested Fields

It is important to note two things:

  1. The data is still flat (i.e. it isn’t a one-to-many relationship)
  2. This was accomplished by using a set of objects as the datasource

The first thing I did was create two classes:

public class Person
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public DateTime BirthDate { get; set; }
    public Contact Contact { get; set; }
}

public class Contact
{
    public string Address { get; set; }
    public string City { get; set; }
    public string Region { get; set; }
    public string PostalCode { get; set; }
    public string Country { get; set; }
    public string Phone { get; set; }
}

Note that there is a Nested Field (Contact) which contains additional information.

snapControl1.Document.DataSources.Add("Employees", Retrieve.Persons());

Finally I add an array of Persons (Person[]) as a DataSource. Done!

Data Source Wizard

One of the best features of our dashboard designer was the introduction of the powerful data source wizard. We’ve taken this powerful wizard and added it into Snap reporting:

Data Source Wizard

This will activate the same DataSource wizard available in our dashboard software:

Data Source Wizard Options

Running through the wizard will the provide the appropriate fields and allow your users to get up and running quickly with little to no developer intervention.

Snap Report

Summary

I would love your thoughts! We are making a strong push in our data analysis and presentation groups to simplify the interaction surface of our products in an effort to make it easier to produce more compelling data visualizations and reports. How are we doing?

As always, if there are any comments and/or questions, feel free to get a hold of me!

Seth Juarez
Email: sethj@devexpress.com
Twitter: @SethJuarez

4 comment(s)
Nate Laff
Nate Laff

Snap is awesome, but I want the best of both worlds. XtraRichEdit and Snap.

I want to add merge fields to the document as well as tables and lists so I can create a letter that has a detail collection.

For example,

Hello, <Seth>!

Thanks for your order on <7/24/2013>. Below is a list of items in your order.

StartList

<Item1Name>    <Item1Description>    <Item1Price>

<Item2Name>    <Item2Description>    <Item2Price>

EndList

See what I mean?

24 July, 2013
Seth Juarez (DevExpress)
Seth Juarez (DevExpress)

Nate:

  Great comment! Would the Snap API help in this case: help.devexpress.com or are you looking for a way to create a flow region (as opposed to always having tables)?

-Seth

24 July, 2013
Nate Laff
Nate Laff

Yeah, I don't always want tables. Every field you drop onto Snap creates a table. If its a string/int/datetime/other type property it should create a merge field. If you drop a collection it should create a table and show the wizard to customize the table data.

24 July, 2013
Stepan Lauryn
Stepan Lauryn

I agree with Nate, snap is good product. It is just wanted a bit of sharpening :-). I wrote some issues about "supress repeating value" i table.

Stepan

25 July, 2013

Please login or register to post comments.