Have some hierarchical data that I have been trying to format in a specific manner and have not been able to get a report layout to display it in the manner I am attempting. I have two-level hierarchical data, say an Order which contains multiple Items. What I would like to do is display the data in this way:
| Item columns | Order columns |
ProductId Quantity Price OrderDate OrderComments
1 1 10.0 3/1/2013 Customer has asked
2 2 21.5 for expedited delivery.
3 7 3.75
3 3 10.2 3/1/2013 Products not in stock as
4 2 17.3 of 3/1. Will backorder
and let customer know.
Where I am showing both the Order and Item data on a single line, and the Order data wraps into additional rows as needed. The Item level records start on the same line as the Order level record and takes up as many rows as is needed to show all Item records.
Is there any way to represent hierarchical data in this way using NetAdvantage Reporting?
Hi Jerry,
Yes, you can make a report with hierarchical sections and/or tables to represent your data.
You can look at the Nested Sections and Hierarchical Table sample, and the following help topics:
Note: the Order Comments will make the rows grow, but rows will not overlap with each other.
Let us know if you have any questions!
Regards,Héctor
But that's exactly what I am trying to do as illustrated in my initial email. I want to be able to show the higher-level Order data and the Item data in the same set of rows so that the Order Comments that you mentioned and other Order level fields will wrap as far into the rows beneath as necessary. Again it would look something like:
I see -- ok how would I be able to design the report in that way that the Order columns would only be populated for the first Item record?
Thanks.
You can use conditional formatting to hide the content for a given cell. Basically, on the cell that has content that needs hiding, add a binding to the Visible property that returns true if the Item record is the first. For instance, on the screenshot from the previous post, a property called Row was added, and with the expression =If(Row = 1; "true", "false"), only on the first Item the order data is displayed.
Ok I see -- I wasn't sure if it were possible to do it through the expression assistant or whether i would have to do that through binding. In order for me to display the Order level data on the same row as the Item level data though I would need to be able to access the Order level fields from the Item level fields, which means I would need to have a reference in the Item class to it's parent Order object, correct?
I have another question in regards to report composition -- is there any native ability in NetAdvantage Reporting to create composite reports that are made up of one or more sub-reports? I am wondering if that could be done at either report design time or through the XAML configuration in a WPF application.
jerry hikel said:I wasn't sure if it were possible to do it through the expression assistant or whether i would have to do that through binding.
Just in case, you can also edit the binding using the Expression Assistant, by expanding the the Visible property, clicking on the DataBinding property, then click on the ellipsis button to open the Expression Assistant.
jerry hikel said:In order for me to display the Order level data on the same row as the Item level data though I would need to be able to access the Order level fields from the Item level fields, which means I would need to have a reference in the Item class to it's parent Order object, correct?
That is one way to do it, but it is not really necessary. You can also have a two level table like the following (see image below). The table has the DataContext of Orders with just the headers, then add a subtable whose DataContext uses the item collection. From the items row, you can refer to fields of the Orders using the Parent prefix instead of the Fields prefix.
jerry hikel said:I have another question in regards to report composition -- is there any native ability in NetAdvantage Reporting to create composite reports that are made up of one or more sub-reports? I am wondering if that could be done at either report design time or through the XAML configuration in a WPF application.
We do not support subreports at this moment.
Ok thanks. I have one more question for now -- thanks so much for the quick responses. I see that you can set up bindings using the expression assistant for specific fields in tables, etc. I was wondering what binding capabilities that the XamReportViewer exposed besides the data source. I really prefer to define my bindings and other configuration within XAML for some items as in that way I get to take advantage of styles and templates defined in my resource dictionaries.
You can set PageFit to FitToPage or FitToWidth, there is a small margin in those cases (between the page and the edge of the control) that is there by design to support touch scenarios.
EDIT: In case you want the viewer control dimensions to expand automatically, it behaves like a standard control, if you remove its dimensions it should expand, otherwise you need to check wether the stackpanel itself is expanding.
I see -- I didn't think about utilizing parameters as data that can be used to define expressions.
When I am placing a XamReportViewer inside of a control, is there any method available to have it automatically take up all available space that that control provides? I have been able to set the PageFit to ZoomScale and then set ZoomScale to the exact right percentage to have the viewer take up the entire available space, however if I don't set that it will only take up a certain amount of width within the control according to the PageFit attribute. I am wondering if it is possible to force the viewer control to take up all available space in it's containing control (in this case i have it as one item in a horizontally-oriented StackPanel).
Many of the properties you mention are bindable to expressions, so you can either pass the desired values as parameters to your report or as a data source. Defining the layout of the report per se is not possible though. You can then bind parameters and data sources through XAML.
I see that -- actually I'm wondering if it would be possible to define something like a table row-level binding on properties like color, font etc. through the XAML. That would require the ability to define the layout of the report through XAML though so it most likely is not available. I understand that I can get binding for those properties by using the expression assistant which would then store that information to the igr table.
Yes, there are several bindable properties in XamReportViewer (full list - see public members for dependency properties), such as: