How can we get the sum of the current page rows/data and how do we know new page is being added in multipage widget? - pdf

How to find sum of all the rows in a particular page. I am using Multipage widget and my data (rows) span across multiple pages. So i want to achieve the below.
End of the every page i want to show, sum of number of rows printed in this particular page.
I show the data by grouping the category. for ex, if i take the classic example of invoice page that was given in dart-pdf package in the below screen shot, it shows 10 detail record rows in this page. so in the footer record for this page, i want to show total number of row = 10 and total $ amt = 955.82. This is one problem i am facing. Footer callback function is being called after all detail records are painted and hence i assume i can't use this callback. but i can try store the detail records count in some global variable and can use this in footer call back but the problem is how do i know this is last row is being written in this page. I am unable to find out any call back to say new page is added or end of page etc. if i know this is end of the page then i can count how many rows written so far. similarly if we have any callback explaining new page is being added when data span across multiple pages that would be nice to achieve.
Another use case is, assume that your invoice page (above screen shot) is given for one category (in other words group by category) and if this category span across to next page then in next page first row, i should say this "same category invoice records are continued in this page". In order to show this, i need to know whether new page is being painted or not. is there a way to achieve this?
my widget tree is pdf.addpage -> multipage -> Table -> tablerow -> other widgets.
Appreciate the response. Thanks!

Related

ngx datatable vertical scroll bar does not come back to start of page if there there are more records than defined page size

Pre condition -
Have pagination, searchTerm, and vertical scrolling implemented and works fine.
records to show per page = 25
Steps to reproduce
User has searched for say 'batMan0' in the list of 100 files. Let's say names are from batMan001.txt to batMan099.txt.
User then scrolls to say page 2 by grabbing scrollbar and pulling it down. Now total number of files on the table is = 50 ( batMan001.txt to batMan050.txt)
Now user refines the search term to 'batMa', (so that search result increases). Once the search is finished, pageNumber resets to 0. This is OK.
The Problem -
Problem is with scroll bar. It does not come back to first row of the table and stays at the same place where user has left on table last time. And because of this, the rows are not visible and user has to scroll up to see the table rows.
How can I fix this issue i.e. bring back the scroll bar to first position.
Any help would be highly appreciated.

PageNumber / TotalPages on group header in report .rdlc

I have a .rdlc report where I have no header (I have group headers)
I want to put the PageNumber on the group header.
If I use Globals!PageNumber I get this error:
The Value expression for the textrun 'Textbox12.Paragraphs[0].TextRuns[3]' refers to the global variable PageNumber or TotalPages. These global variables can be used only in the page header and page footer
Is there any way I could do this?
If there is no possibility to put this data on a group header...is there any possibility of overlap a header with the group header on a same line?
Global variables can't be used outside of the header/footer, as there is no relationship between the header/footer and body areas. Therefore, there is no easy and precise way to display the page number in the body area.
However, as suggested by user Raymond-Lee in the second link, you can try to calculate it yourself by dividing a given row number by the total number of rows per page (and adding one if the page number will always be the first row). Nonetheless, this would take a bit of effort.
First you need to have the Page Header/Footer showing, then you can add items to it. To show it, right click in the pale yellow area of the Layout view. Then select Page Header and/or Page Footer, this will create another section on your report where you can add items. Or, you can go to the Report menu option and enable the Page Header/Footer from there.
link

Microsoft Access Report - Sub Report carries over 2 pages, but access thinks it is one?

I've reworded the title and this description because the last one didn't make much sense.
Basically, I have a report that displays business details. Some of these details include:
Business Name
Address
Documents
Clients
When the report is formatted (Print View), the business name and it's corresponding page number are added to a table(BusinessPage). The code for this is placed in the 'On Format' event of the first group header, I have listed the code below:
Dim RST As DAO.Recordset
Set RST = CurrentDb.OpenRecordset("BusinessPage", dbOpenTable)
RST.AddNew
RST![Business Name] = BUSName
RST![Business Page] = Me.Page
RST.Update
RST.Close
CurrentDb.Execute "SELECT DISTINCT * INTO t_temp FROM BusinessPage"
CurrentDb.Execute "DELETE FROM BusinessPage"
CurrentDb.Execute "INSERT INTO BusinessPage SELECT * FROM t_temp"
CurrentDb.Execute "DROP TABLE t_temp"
The table will look something like this:
Business Name Page No
Business 1 3
Business 2 4
Business 3 6 'This indicates that Business 2 spans over two pages as page 5 is skipped'
Business 4 7
In the report header, I have two things:
A cover page
An Index Sub Report/Page
The index page (Sub Report) takes the information from the table(BusinessPage) and lists all of the businesses in the report, along with the page numbers that they start on.
Now that you have an idea of how this works, here is my problem:
The sub report works fine if it only takes up one page. The issue I have is when the sub report lists too many records and it carries over onto the second page. For some reason, access still thinks that the sub report is on one page, even though it's created another page. Despite it thinking that, the footer that contains the code ([Page]) displays correctly. However, the code that displays the total amount of pages ([Pages]) is wrong. At the end of the report, the footer will say something like this:
Page 50 of 49
The other issue I have is that the information that is added to the table is wrong when the sub report exceeds one page. The information added is in assumption that the sub report is still on one page.
For example, when the sub report takes up one page:
Page 1: Cover Page
Page 2: Sub Report/Index
Page 3: Business 1
Sub report will correctly display:
Business 1 Page 3
When the sub report takes up 2 pages:
Page 1: Cover Page
Page 2: Sub Report/Index
Page 3: Sub Report/Index
Page 4: Business 1
The sub report/index page will still display:
Business 1 Page 3
Whereas it should be displaying it as:
Business 1 Page 4
Does anybody have any idea of how I can correct this? I have a feeling it may be because the sub report is in the report header (But I need it there because it will only ever be displayed once at the start of the report). Is there another way to create a secondary report header to test this theory?
Let me know if anybody thinks of any other solutions!
Edit:
I moved the sub report into it's own group/header, away from the Report Header.
This didn't change anything, access still thinks it's displaying on one page even though it's not. I have another hunch that access thinks it's on one page due to the size of the sub report in design view? The sub report in design view will fit on one page before bringing in the data, could this be the issue? How would I go about fixing that?
I was thinking, maybe an if statement to decide how big the sub report turns out, if it's the length of 2 pages, then alter the code to become:
RST![Business page] = Me.Page + 1
This is still quite a shoddy fix though, and I'm not sure how I'd go about writing the if statement to calculate the length of the page
What is happening here (I think):
When the main report is opened, BusinessPage is empty, therefore your index subreport has some minimal height.
Then Access sees you use [Pages], so it has to prepare the whole report, i.e. the Format event for all pages runs, adding the records to BusinessPage. During this, Access still assumes the minimal subreport and assigns the page numbers accordingly.
After that your index is generated, using the original page numbers - which will be wrong if the index covers >1 pages.
So I think you should do:
Before opening the report (or perhaps in Report_Open), prefill the BusinessPage table with all records that will be in there, but with a dummy page number (e.g. 0).
So the index subreport will have its correct height, and the page numbers that are generated in the Format events should be correct.

BigCommerce - how to add an extra column in the category page layout?

I am new to this so I hope my question is relevant and useful to others.
I have a bigcommerce store and I removed the side category display panel from the category page (I did not want a side category to dispay) but this has now left me with only 4 columns of products displayed on a page 5 columns wide. Could any kind person tell me how to add an extra column of products, so that the page width is full again, or how to alter the image size so that 4 columns of product images fills the space previously occupied by 4+sidecategory ?
To change the layout of your category page you require to do change in category.html. As per your requirement you need to remove the below code from the category.html (Any change in this file will reflect in all your category pages)
<div class="Left fleft">
%%SNIPPET_SubCategories%%
%%Panel.SideCategoryShopByPrice%%
</div>
I am saying to remove the entire side column div because you want the full page layout but you can just remove the particular snippets or panels which you don't want but with that sometime what happens is like any panel which is currently not active from admin panel but later whenever it will active then it shows the problem like your layout will display with side column having that particular panel and also your wide column (products column) with 5 products in a row.
After this you have to do change in css file named styles.css, In this file search for the .ProductList li in which you can see the width which is given in percentage to 25 so please make it to 20.
Please save the above files and you can see the changes.
Thanks.

How can I add row of components to a GUI when a button has been pressed?

I'm putting together an app where a user can record information about like a sale of an unknown number of items in a business. My question is based on recording the quantity, name, individual price and total price of each item sold in a sale. I've already coded a java computer program where I have a table available on the GUI, the user records the information of one item in a table and if they need more rows there is a button which can be pressed each time a new row is needed. I'm wondering:
A) is there a table component I can use in Codenameone on the GUI and
B) can I have the same concept of pressing a button in order to add a new row to the table?
If this isn't possible, because I've had no luck while researching this topic, does anyone have any suggestions of how I can record an unknown number of items for a sale on one GUI page?
UPDATE:
Here is the code which is in the method that adds a new row to the table container.
protected void onSale_ButtonAction(Component c, ActionEvent event) {
Container tbl = findTbl(c);
TextField txt = new TextField();
ComboBox cmb = new ComboBox();
TextField txt2 = new TextField();
tbl.addComponent(txt);
tbl.addComponent(cmb);
tbl.addComponent(txt2);
tbl.animateLayout(300);
}
The button does add the new row but it changes the table layout by resizing all the components and some aren't visible on the screen. I have used the setWidth() method after declaring each component in hope of changing the size of the component but with no luck. How can I solve this problem, so that the new components are the same size as the very first row of components in the table?
And also, after a random number of rows have been filled in with information, i'd like to read this info and save it to a database. I've done this in a computer java program in a JTable and stored the data into a 2D array and then read from the array into the database. Is this method applicable for the container above?
There are "table components" specifically Table, TableLayout & GridLayout.
Adding a row to each of them is somewhat different, lets assume you use a TableLayout container with the container being tbl and having 2 columns:
tbl.addComponent(cmp1);
tbl.addComponent(cmp2);
tbl.animateLayout(300);
Adds both components and animates them into place.