I have a Dialog that needs to fill a ListView control with a subset of records from a 1 million record file where I have up to 10 different criteria items each record has to pass before it is placed in the listview.
My first method filled a table with the results while displaying a smallish dialog with a progress bar. Then after the scan and I have a table, I started another progress bar indicating that it was now loading the listview. Then when it finished loading the listview I show the results screen and allow them to sort by columns, save the result to a another file (dbf) (for loading into Excel or Access) or a text file or discard it.
That method has worked fine until we started getting those million record files to scan where there was no way to really optimize the scan. (Not using SQL)
Someone at work here asked, "why spend the time creating the initial table, just load the listview directly as a record qualifies". I had to agree that was a great idea and would eliminate 40% to 80% of the processing time.
Anyway, I've come up with the following method that seems to work but want to check to see if I'm just lucky.
Steps.
1. Do a Dialog New and add one control to it, the Listview control.
2. Start looping through the records adding to the listview (not yet shown with Dialog Show Modal) and update a progress bar in another window that is visible. Allow the run to be terminated during the Scan phase.
While the scan progress bar shows the progress it can be minimized and cause the results screen to also be minimized by passing a flag.
The scans can take anywhere from 2 seconds to 10 minutes depending on the size of the file being scanned and whether we can optimize the scan using a sorted field in the query.
3. When the scan is complete then add all the other controls which include the number of hits and total number of records etc
4. Then do a Dialog Show Modal and start processing the dialog callback.
5. If they chose Excel or a Text file, then I build the table by reading the listview row by row. (Since the results listview can be sorted, I had to do this anyway)
The question is: Is there any problem creating a new dialog and then not showing it for as long as it takes for the listview to fill? (So far in testing it holds at least 750,000 records in the listview)
The time savings by not doing the initial results table is 40% to 80% depending on the hardware being used.
Bob Mechler
My first method filled a table with the results while displaying a smallish dialog with a progress bar. Then after the scan and I have a table, I started another progress bar indicating that it was now loading the listview. Then when it finished loading the listview I show the results screen and allow them to sort by columns, save the result to a another file (dbf) (for loading into Excel or Access) or a text file or discard it.
That method has worked fine until we started getting those million record files to scan where there was no way to really optimize the scan. (Not using SQL)
Someone at work here asked, "why spend the time creating the initial table, just load the listview directly as a record qualifies". I had to agree that was a great idea and would eliminate 40% to 80% of the processing time.
Anyway, I've come up with the following method that seems to work but want to check to see if I'm just lucky.
Steps.
1. Do a Dialog New and add one control to it, the Listview control.
2. Start looping through the records adding to the listview (not yet shown with Dialog Show Modal) and update a progress bar in another window that is visible. Allow the run to be terminated during the Scan phase.
While the scan progress bar shows the progress it can be minimized and cause the results screen to also be minimized by passing a flag.
The scans can take anywhere from 2 seconds to 10 minutes depending on the size of the file being scanned and whether we can optimize the scan using a sorted field in the query.
3. When the scan is complete then add all the other controls which include the number of hits and total number of records etc
4. Then do a Dialog Show Modal and start processing the dialog callback.
5. If they chose Excel or a Text file, then I build the table by reading the listview row by row. (Since the results listview can be sorted, I had to do this anyway)
The question is: Is there any problem creating a new dialog and then not showing it for as long as it takes for the listview to fill? (So far in testing it holds at least 750,000 records in the listview)
The time savings by not doing the initial results table is 40% to 80% depending on the hardware being used.
Bob Mechler
Comment