Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 11 to 13 of 13 total |
Load Data. Real Async? |
Fri, Oct 19 2018 2:41 AM | Permanent Link |
Eivind | Raul / Walter
Thanks for your input regarding Javascript and how EWB handles Load requests! From you discussions I have learned what I needed to build a failure / retry routine and it seams to work perfectly now that I understand the internals of dataset loading. Cheers Eivind |
Tue, Oct 23 2018 2:08 AM | Permanent Link |
Richard Harding Wise Nutrition Coaching | This is my version of managing the loading of datasets. Create an event for 'LoadComplete', as well as similar events for 'RollbackError', 'CommitError', 'AfterCommit' and 'BeforeCommit'. It is one way of separating data module functions from the user forms.
Use DownloadRows to retrieve the required DSs and set 'NumLoadRowsIncomplete' to the number of DSs being downloaded. When a DS is loaded, decrement 'NumLoadRowsIncomplete' and when it equals zero, everything has been downloaded. Richard ======================================================== unit DataModule; interface uses WebCore, WebData, WebForms, WebHTTP; type TDataSetLoadCompletedEvent = procedure(aTableName: string) of object; TdbDatabaseDB = class(TDatabase) esStockCategories: TDataSet; esStockSummary2: TDataSet; procedure esStockCategoriesAfterLoad(Sender: TObject); procedure esStockSummary2AfterLoad(Sender: TObject); private { Private declarations } public { Public declarations } NumLoadRowsIncomplete: integer; OnStockSummary2DataSetLoaded: TDataSetLoadCompletedEvent; OnStockCategoriesDataSetLoaded: TDataSetLoadCompletedEvent; end; var dbDatabaseDB: TdbDatabaseDB; implementation procedure TdbDatabaseDB.esStockCategoriesAfterLoad(Sender: TObject); // Duplicate for each DS begin if assigned(OnStockCategoriesDataSetLoaded) then OnStockCategoriesDataSetLoaded(TComponent(Sender).Name); Dec(NumLoadRowsIncomplete); if NumLoadRowsIncomplete = 0 then begin async HideProgress; end; end; end. ================================================================================== unit LoadDS; interface uses WebCore, WebUI, WebForms, WebCtrls, WebCtnrs, WebBtns, WebLabels, WebEdits, WebGrids, WebHTTP; type TfmLoadDS = class(TDialog) {... } procedure fmLoadDSShow(Sender: TObject); procedure dDSCreate(Sender: TObject); private { Private declarations } procedure wncStockSummary2DataSetLoaded(aDataSetName: string); procedure wncStockCategoriesDataSetLoaded(aDataSetName: string); public { Public declarations } end; var fmLoadDS: TfmLoadDS; implementation uses DataModule; procedure TfmLoadDS.wncStockSummary2DataSetLoaded(aDataSetName: string); begin LogOutput('Stock Summary 2 Loaded', 'log'); end; procedure TfmLoadDS.wncStockCategoriesDataSetLoaded(aDataSetName: string); begin LogOutput('Stock Categories Loaded', 'log'); end; procedure TfmLoadDS.fmLoadDSShow(Sender: TObject); begin { stuff } dbDatabaseDB.OnStockSummary2DataSetLoaded := wncStockSummary2DataSetLoaded; dbDatabaseDB.OnStockCategoriesDataSetLoaded := wncStockCategoriesDataSetLoaded; dbDatabaseDB.esStockSummary2.Open; dbDatabaseDB.esStockCategories.Open; dbDatabaseDB.NumLoadRowsIncomplete := 2; dbDatabaseDB.LoadRows(dbDatabaseDB.esStockCategories); // Really big DS - many seconds to load dbDatabaseDB.LoadRows(dbDatabaseDB.esStockSummary2); // Tiny DS ShowProgress('Loading rows'); end; |
Tue, Oct 23 2018 2:23 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Eivind,
<< Just a quick question regarding multiple Load Data requests. In one form I need to load data into 6 Data sets. I fire the load requests all at once the Form show proc. Further down the lines I show the overlay letting the user know that data is being loaded and as one by one dataset returns with data I set a "loaded" flag on each dataset. A timer then runs and wait for all 6 datasets to load and then hide the overlay. When I look at how the browser handles these load requests it looks like they are handled in a sequence? When for example looking at Chromes "waterfall" list it shows that first one request starts, then as soon as the first one completes, the second one starts. Is this how the browsers handles multiple requests, or is this how EWB handles multiple requests? >> As Raul indicates, this is just how EWB handles the database/dataset requests in order to make sure that they don't get out of order and you get weird results (commit/load/commit/load). This is especially important if there are errors with any given operation. At some point I'll probably add the ability to load multiple datasets at the same time, but for now you can use a plain TServerRequest(s) along with this method: https://www.elevatesoft.com/manual?action=viewmethod&id=ewb2&comp=TDataSet&method=LoadRows to do what you want. Tim Young Elevate Software www.elevatesoft.com |
« Previous Page | Page 2 of 2 | |
Jump to Page: 1 2 |
This web page was last updated on Thursday, March 28, 2024 at 06:05 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |