This commit is contained in:
Atanas Keranov 2018-03-14 14:07:14 +02:00
Родитель 54d8bb86b5
Коммит 5f6e553eca
3 изменённых файлов: 41 добавлений и 40 удалений

Просмотреть файл

@ -34,15 +34,15 @@ Examples of setting the ReportSource of HTML5 WebForms Report Viewer:
*C#*
```c#
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Telerik.ReportViewer.Html5.WebForms.ReportSource reportSource = new Telerik.ReportViewer.Html5.WebForms.ReportSource();
reportSource.IdentifierType = Telerik.ReportViewer.Html5.WebForms.IdentifierType.UriReportSource;
reportSource.Identifier = "Report1.trdp";
reportViewer1.ReportSource = reportSource;
}
}
{
if (!IsPostBack)
{
Telerik.ReportViewer.Html5.WebForms.ReportSource reportSource = new Telerik.ReportViewer.Html5.WebForms.ReportSource();
reportSource.IdentifierType = Telerik.ReportViewer.Html5.WebForms.IdentifierType.UriReportSource;
reportSource.Identifier = "Report1.trdp";
reportViewer1.ReportSource = reportSource;
}
}
```
*VB*

Просмотреть файл

@ -3,7 +3,7 @@ title: How to create waterfall chart with Graph item
description: Create waterfall chart that shows accumulated data values using the Graph item
type: how-to
page_title: How to create waterfall chart with the Graph item
slug: how-to-create-waterfall-chart-with-graph-item
slug: how-to-create-waterfall-chart-using-graph
position:
tags: styling,graph,chart
ticketid: 1157441
@ -42,24 +42,28 @@ Total,0
Note that the last column, *Total* doesn't have an explicitly set value, because it should be calculated as an aggregate of all the previous intermediate values.
The steps, needed to produce a waterfall chart are listed below:
1. Start by creating a clustered column chart with the graph wizard , as explained here: [How To: Create Column Chart](https://docs.telerik.com/reporting/graphhowtocreatecolumnchart).
2. When arranging the graph fields, drag the **Item** field for *Categories* box and **Value** field for *Values* box.
3. Remove the sorting from the category group to ensure the data will be ordered as it is in the data source.
4. Select a datapoint from the produced column series and set its Y property to
```
= RunningValue('graph1', Sum(Fields.Value))
```
and its Y0 property to
```
= IIF(Fields.Item = Exec('graph1', First(Fields.Item)),
0,
IIF(Fields.Item = Exec('graph1', Last(Fields.Item)),
0,
RunningValue('graph1', Sum(Fields.Value))- Sum(Fields.Value)))
```
The latter expression checks if the datapoint represents the first or the last item and then sets its Y0 property to 0, so the datapoint will span to the horizontal axis.
Otherwise subtracts the current datapoint value from the accumulated sum to calculate the bottom coordinate of the datapoint.
```
= RunningValue('graph1', Sum(Fields.Value))
```
and its Y0 property to
```
= IIF(Fields.Item = Exec('graph1', First(Fields.Item)),
0,
IIF(Fields.Item = Exec('graph1', Last(Fields.Item)),
0,
RunningValue('graph1', Sum(Fields.Value))- Sum(Fields.Value)))
```
The latter expression checks if the datapoint represents the first or the last item and then sets its Y0 property to 0, so the datapoint will span to the horizontal axis.
Otherwise subtracts the current datapoint value from the accumulated sum to calculate the bottom coordinate of the datapoint.
5. Assign the desired colors to the graph series using [Conditional formatting](https://docs.telerik.com/reporting/styling-conditional-formatting) rules.
## See Also

Просмотреть файл

@ -1,8 +1,8 @@
---
title: How to hide a Subreport with no data
description: Hide Sub-Report Header/Footer and Subreport item when its data source is empty
title: How to hide a SubReport with no data
description: Hide sub-report and SubReport item when its data source is empty
type: how-to
page_title: Hide empty subreport item from main report
page_title: Hide empty sub-report from main report
slug: how-to-hide-subreport-with-no-data
position:
tags:
@ -12,10 +12,6 @@ res_type: kb
## Environment
<table>
<tr>
<td>Product Version</td>
<td></td>
</tr>
<tr>
<td>Product</td>
<td>Progress® Telerik® Reporting </td>
@ -24,23 +20,24 @@ res_type: kb
## Description
Sometimes you would like to hide the Subreport(s) (i.e. Report Header/Footer and the Detail Section) if there is no data to display inside.
Sometimes you would like to hide a sub-report if there is no data to display inside.
By default the Subreport item inside the main report would occupy the preserved (design-time) space even if its content is empty.
By default the SubReport item inside the main report would occupy the preserved (design-time) space even if its content is empty.
The Detail Section is rendered for each data record, so if there is no data, there will be no Detail Section in the (Sub)report. However, the (Sub)report Header/Footer would still be rendered.
The Detail section is rendered for each data record, so if there is no data, there will be no Detail section in the sub-report. However, the sub-report's Header/Footer section would still be rendered.
## Solution
1. Forcing the Subreport item not to occupy space in the main report when empty:
To mimic hiding of the Subreport item inside the main report, you could set its height to '0' (zero inches).
This way it will not occupy space when there is nothing to render. However, when there is data in the Subreport, it will grow downwards automatically to occupy the needed space.
### Forcing the SubReport item not to occupy space in the main report when empty
2. Forcing the report referenced by the Subreport item to render blank/empty when there is no data:
To mimic hiding of the SubReport item inside the main report, you could set its height to '0' (zero).
This way it will not occupy space when there is nothing to render. However, when there is data in the sub-report, it will grow automatically to occupy the needed space.
When the Subreport DataSource is not directly dependent on the main report DataSource it is enough to hide the Subreport Header/Footer when there is no data. You could use [Bindings ](https://docs.telerik.com/reporting/expressions-bindings) to set Header/Footer _Visible_ property, for example with the expression _'=Count(Fields.SomeFieldValue) \> 0'_.
### Forcing the sub-report referenced by the SubReport item to render blank/empty when there is no data
When the Subreport DataSource is directly dependent on the main report DataSource, i.e. it is set (using Bindings) with the expression '= ReportItem.DataObject', you can use another Binding (also directly on the Report referenced by the Subreport item) to set its _Visible_ property to an expression evaluated to _True_ only when the 'ReportItem.DataObject.SubreportData' is not Null/empty - for example when 'SomeFieldValue' is a single string passed from main report to the Subreport, the expression could lool like '= ReportItem.DataObject.SomeFieldValue <> ""'.
When the sub-report's data source is not directly dependent on the main report's data source it is enough to hide the sub-report's Header/Footer when there is no data. You could use [Bindings](https://docs.telerik.com/reporting/expressions-bindings) to set the Header/Footer section's _Visible_ property, for example with the expression _'=Count(Fields.SomeFieldValue) \> 0'_.
When the sub-report's data source is directly dependent on the main report's data source, i.e. it is set (using Bindings) with the expression '= ReportItem.DataObject', you can use another Binding (also directly on the Report referenced by the SubReport item) to set its _Visible_ property to an expression evaluated to _True_ only when the 'ReportItem.DataObject.SubreportData' is not Null/empty - for example when 'SomeFieldValue' is a single string passed from main report to the SubReport, the expression could look like '= ReportItem.DataObject.SomeFieldValue <> ""'.
## Notes
The suggested approach assumes that the Subreport has a DataSource (that could return empty data set) assigned directly to the Subreport report item. If the report DataSource is null the approach will not work as expected.
The suggested approach assumes that the SubReport has a data source (that could return empty data set) assigned directly to the SubReport report item. If the report DataSource is null the approach will not work as expected.