RE: Export takes way too long
Ray:
I went ahead and indulged myself in reading the thread. You have to forgive me, but whenever I see threads with responses with half page long xbasic, I feel something ain't right and I move on !! but your thread addresses an interesting issue. I have few observations:
1-If all you are trying to do is export to a text file, then how about the following suggestions:
a-Have you tried to use a blob? I am no expert on blobs, but the xbasic most likely would be something like this:
"TBL".RECORD_DATA_GET()
FILE.FROM_BLOB()
In this case there are no filters involved and no querries.
b-Have you tried to simply save the form layout as txt, or create a report then print it to a text file? Would that be any faster? The xbasic would be:
query.filter = ""
query.order = ""
:Form.SaveAs("form_name","TXT",query.filter,query.order,"",.T.)
c-How about merging into a text file instead of exporting? how does that compare in terms of speed?
2-I am not sure I see where does the speed comes from in your work-around: you are still using a query and a filter. In the filter, instead of using between(), you are using query.filter = "recno() = " + record_number which is still a filter. I thought you blamed the delay on filters and you were trying to get away from having to use a filter. One would conclude then that the delay comes from the expression itself (between()) and not simply from using a filter per se.
3-Your thread opens the door to an important issue: while I am not in the importation/exportation business and I suspect a lot of users are not, but more often than not users need to perform functions on the current record, more like printing the current invoice or the like. The method I use to accomplish that is the one I suggested earlier. I do not have a million-record DB and as such never sensed any delays. But, if there is a better way to export the current record more expediously, then maybe the same concept should be applied to other more commonly used functions on current records. As I said, it might be simply a matter of changing the filter itself.
Gabe
Ray:
I went ahead and indulged myself in reading the thread. You have to forgive me, but whenever I see threads with responses with half page long xbasic, I feel something ain't right and I move on !! but your thread addresses an interesting issue. I have few observations:
1-If all you are trying to do is export to a text file, then how about the following suggestions:
a-Have you tried to use a blob? I am no expert on blobs, but the xbasic most likely would be something like this:
"TBL".RECORD_DATA_GET()
FILE.FROM_BLOB()
In this case there are no filters involved and no querries.
b-Have you tried to simply save the form layout as txt, or create a report then print it to a text file? Would that be any faster? The xbasic would be:
query.filter = ""
query.order = ""
:Form.SaveAs("form_name","TXT",query.filter,query.order,"",.T.)
c-How about merging into a text file instead of exporting? how does that compare in terms of speed?
2-I am not sure I see where does the speed comes from in your work-around: you are still using a query and a filter. In the filter, instead of using between(), you are using query.filter = "recno() = " + record_number which is still a filter. I thought you blamed the delay on filters and you were trying to get away from having to use a filter. One would conclude then that the delay comes from the expression itself (between()) and not simply from using a filter per se.
3-Your thread opens the door to an important issue: while I am not in the importation/exportation business and I suspect a lot of users are not, but more often than not users need to perform functions on the current record, more like printing the current invoice or the like. The method I use to accomplish that is the one I suggested earlier. I do not have a million-record DB and as such never sensed any delays. But, if there is a better way to export the current record more expediously, then maybe the same concept should be applied to other more commonly used functions on current records. As I said, it might be simply a matter of changing the filter itself.
Gabe
Comment