Philip Chatzigeorgiadis Active Member Licensed User Longtime User Jul 3, 2020 #1 I am trying to use the ABMReport. The example provided here [ABMaterial] Printing/Reporting with the upcoming version 3.75 A sneak peek on a new feature of ABMaterial I'm working on: Printing/Reporting. This is an example of a report in ABMaterial. You build it right into your other pages and just by setting a couple of parameters, you control what will be shown on screen and what will be printed. The block your... www.b4x.com creates and shows the report in the ConnectPage section with this code: B4X: Copy Dim myReport As ReportInvoice myReport.Initialize(page, "myreport") page.Cell(4,1).AddComponent(myReport.Report) So, the report is created, populated with data and shown upon page creation. All data are created in the Report_Build sub This works fine. I also modified the code to use queries to populate the report. However, usually a report needs to be generated after a certain event (e.g. user selects the invoice number for which a report is needed). How can I generate the report outside ConnectPage? Last edited: Jul 3, 2020
I am trying to use the ABMReport. The example provided here [ABMaterial] Printing/Reporting with the upcoming version 3.75 A sneak peek on a new feature of ABMaterial I'm working on: Printing/Reporting. This is an example of a report in ABMaterial. You build it right into your other pages and just by setting a couple of parameters, you control what will be shown on screen and what will be printed. The block your... www.b4x.com creates and shows the report in the ConnectPage section with this code: B4X: Copy Dim myReport As ReportInvoice myReport.Initialize(page, "myreport") page.Cell(4,1).AddComponent(myReport.Report) So, the report is created, populated with data and shown upon page creation. All data are created in the Report_Build sub This works fine. I also modified the code to use queries to populate the report. However, usually a report needs to be generated after a certain event (e.g. user selects the invoice number for which a report is needed). How can I generate the report outside ConnectPage?
J John Naylor Active Member Licensed User Longtime User Jul 3, 2020 #2 Remove those three lines from your ConnectPage and make a sub which looks like this.... B4X: Copy Sub GenerateReport Dim myReport As ReportInvoice myReport.Initialize(page, "myReport") page.Cell(4,1).AddComponent(myReport.Report) page.Refresh End Sub Add the following to your ConnectPage to add a button that you can use to actually display the report (Obviously in actual use you would do whatever you want to do before calling the above sub but this will demonstrate how to do what you want) B4X: Copy Dim GenRep As ABMButton GenRep.InitializeRaised(page,"DisplayReport","","","Go","") page.Cell(1,1).AddComponent(GenRep) and finally a handler for when the button is clicked B4X: Copy Sub DisplayReport_Clicked (target As String) GenerateReport End Sub So now the program starts and you see the ABMPage but without a report. You can do whatever extra processing you require then call the GenerateReport sub which will display the control when you want it. - In your case you would have a text box for the user to enter an invoice number then generate the report. Last edited: Jul 3, 2020 Upvote 0
Remove those three lines from your ConnectPage and make a sub which looks like this.... B4X: Copy Sub GenerateReport Dim myReport As ReportInvoice myReport.Initialize(page, "myReport") page.Cell(4,1).AddComponent(myReport.Report) page.Refresh End Sub Add the following to your ConnectPage to add a button that you can use to actually display the report (Obviously in actual use you would do whatever you want to do before calling the above sub but this will demonstrate how to do what you want) B4X: Copy Dim GenRep As ABMButton GenRep.InitializeRaised(page,"DisplayReport","","","Go","") page.Cell(1,1).AddComponent(GenRep) and finally a handler for when the button is clicked B4X: Copy Sub DisplayReport_Clicked (target As String) GenerateReport End Sub So now the program starts and you see the ABMPage but without a report. You can do whatever extra processing you require then call the GenerateReport sub which will display the control when you want it. - In your case you would have a text box for the user to enter an invoice number then generate the report.
Philip Chatzigeorgiadis Active Member Licensed User Longtime User Jul 3, 2020 #3 I think i tried this solution with no success but i suspect i might have skipped the page.refresh which you have at the end of the GenerateReport sub. I will implement your suggestion on Monday and revert back with the results. Upvote 0
I think i tried this solution with no success but i suspect i might have skipped the page.refresh which you have at the end of the GenerateReport sub. I will implement your suggestion on Monday and revert back with the results.
J John Naylor Active Member Licensed User Longtime User Jul 3, 2020 #4 The page.refresh got me a few times as I was learning the framework. You should be fine, I've tested the above code in the sample and it certainly works for me ? Upvote 0
The page.refresh got me a few times as I was learning the framework. You should be fine, I've tested the above code in the sample and it certainly works for me ?
Philip Chatzigeorgiadis Active Member Licensed User Longtime User Jul 3, 2020 #5 GymReaper said: The page.refresh got me a few times as I was learning the framework. You should be fine, I've tested the above code in the sample and it certainly works for me ? Click to expand... page.refresh will get me everytime ... Upvote 0
GymReaper said: The page.refresh got me a few times as I was learning the framework. You should be fine, I've tested the above code in the sample and it certainly works for me ? Click to expand... page.refresh will get me everytime ...
alwaysbusy Expert Licensed User Longtime User Jul 3, 2020 #6 Yes, the page.refresh is something like: 'I've defined all the changes on the server side, now push them to the browser'. To speed things up, you can als use the more detailed .refresh methods, like cell.refresh or row.refresh if you have made only changes in a certain cell or row. Page.Refresh will have to go over everything defined on the page to check if they are dirty or not and need to be pushed to the browser. But in most cases page.refresh is fast enough. Upvote 0
Yes, the page.refresh is something like: 'I've defined all the changes on the server side, now push them to the browser'. To speed things up, you can als use the more detailed .refresh methods, like cell.refresh or row.refresh if you have made only changes in a certain cell or row. Page.Refresh will have to go over everything defined on the page to check if they are dirty or not and need to be pushed to the browser. But in most cases page.refresh is fast enough.
J John Naylor Active Member Licensed User Longtime User Jul 3, 2020 #7 Thanks for the input @alwaysbusy id not noticed the more specific refresh options that will come in really handy. Live and learn! Upvote 0
Thanks for the input @alwaysbusy id not noticed the more specific refresh options that will come in really handy. Live and learn!