How to identify the last datarow on page
-
- Posts: 7
- Joined: Fri Jul 02, 2021 1:18 pm
How to identify the last datarow on page
I have a databand with lines of size 1 between the rows. Sometimes my data goes over more than one page and I want to draw a line with size 2 under the last row of the page instead of the line with size 1.
Is there any way to solve this within Designer ?
Is there any way to solve this within Designer ?
-
- Posts: 6266
- Joined: Tue Mar 20, 2018 5:34 am
Re: How to identify the last datarow on page
Hello,
Please check the IsLastPage from system variables (Returns true, if, in the current moment, the last page of a report is printed. For correct calculation of a variable it is required to execute two passes.)
Thank you.
Please check the IsLastPage from system variables (Returns true, if, in the current moment, the last page of a report is printed. For correct calculation of a variable it is required to execute two passes.)
Thank you.
Re: How to identify the last datarow on page
Hi,
are you interested in item of last page or last item on each page?
If "last item on each page": Try to change the rendered components. For this you should use the Report.EndRender event and loop through all RenderedPages of the report and through their components, starting with the last one and stop the loop the first time you find the corresponding component.
Regards
are you interested in item of last page or last item on each page?
If "last item on each page": Try to change the rendered components. For this you should use the Report.EndRender event and loop through all RenderedPages of the report and through their components, starting with the last one and stop the loop the first time you find the corresponding component.
Regards
-
- Posts: 7
- Joined: Fri Jul 02, 2021 1:18 pm
Re: How to identify the last datarow on page
Maybe I didn't get it right...
IsLastPage is true on the first record of the last page (independant from the number of passes).
I nead a "true" when I reach the last record of the current page to make a proper visual termination of the table.
Example: I have a report where the data (60 rows) spreads over three pages, so there are 20 lines per page from the same source (and within the same DataBand).
When I come to the 20th row, I need to know it's the last row of this page (and not the last page, so your hint is usefull anyways).
Unfortunately the rows can grow in hight, so the number of rows per page is dynamic (simply counting is not an option).
IsLastPage is true on the first record of the last page (independant from the number of passes).
I nead a "true" when I reach the last record of the current page to make a proper visual termination of the table.
Example: I have a report where the data (60 rows) spreads over three pages, so there are 20 lines per page from the same source (and within the same DataBand).
When I come to the 20th row, I need to know it's the last row of this page (and not the last page, so your hint is usefull anyways).
Unfortunately the rows can grow in hight, so the number of rows per page is dynamic (simply counting is not an option).
-
- Posts: 6266
- Joined: Tue Mar 20, 2018 5:34 am
Re: How to identify the last datarow on page
Hello,
There is no standard solution.
As a way, you can try to use Double Pass in first-pass check page counts and rows by pages and in the second set the necessary changes in events.
Thank you.
There is no standard solution.
As a way, you can try to use Double Pass in first-pass check page counts and rows by pages and in the second set the necessary changes in events.
Thank you.
Re: How to identify the last datarow on page
Has anyone read my proposed solution? It will work for sure. We are using such adaptions in our reports too...
-
- Posts: 7
- Joined: Fri Jul 02, 2021 1:18 pm
-
- Posts: 7
- Joined: Fri Jul 02, 2021 1:18 pm
Re: How to identify the last datarow on page
My knowledge of double pass is really poor by now, but this could be an opportunity to change it.Lech Kulikowski wrote: ↑Wed Jul 07, 2021 9:25 pm As a way, you can try to use Double Pass in first-pass check page counts and rows by pages and in the second set the necessary changes in events.
I will try your solution, too.
Thanks a lot!
-
- Posts: 6266
- Joined: Tue Mar 20, 2018 5:34 am
Re: How to identify the last datarow on page
Hello,
You are welcome.
You are welcome.
Re: How to identify the last datarow on page
Here is a small sample code for event Report.EndRender
Code: Select all
StiReport report = sender as StiReport;
if (report == null)
return;
// loop through all rendered pages
foreach (StiPage page in report.RenderedPages)
{
// loop through all rendered elements on each page, starting with the last one
for (int i = page.Components.Count - 1; i > 0; i--)
{
StiComponent comp = page.Components[i];
if (comp.Name != "NameOfDataBand") // ignore all other elements
continue;
IStiBorder border = comp as IStiBorder; // ensure, element can have borders
if (border == null)
break;
border.Border.Size = 2; // change border line width
break; // stop loop through components -> only last databand of each page will be changed
}
}