|
| Iniciado por marcov, 09,dic. 2020 18:56 - 2 respuestas |
| |
| | | |
|
| |
Miembro registrado 56 mensajes |
|
| Publicado el 09,diciembre 2020 - 18:56 |
hi, I have a procedure that has to read a txt file of more than 50,000 lines. I currently use this code:
// Read a data file in TXT (import)
sFileContent is string sLine is string sTiporec is string sCodpag is string sCassa is string sImporto is string sGiorno is string
IF EDT_PercFile = "" OR EDT_pagamento="" THEN ToastDisplay("Dati NON Validi",toastLong,vaBottom,haCenter) ELSE // Load the file content in memory ControlVisible(PROGBAR_Horizontal,animScrollBottom,50)
sFileContent = fLoadText(EDT_PercFile)
// Initializes the progress bars to their initial value PROGBAR_Horizontal = PROGBAR_Horizontal..InitialValue FOR EACH STRING sLine OF sFileContent SEPARATED BY CR // Process the line sTiporec = Middle(sLine, 13, 2) sCodpag = Middle(sLine, 15, 2) IF sTiporec = "03" AND sCodpag=EDT_pagamento THEN sCassa = Middle(sLine, 7, 2) sImporto = Middle(sLine, 20, 6) sGiorno = Middle(sLine, 65, 14) // Increments the value of all the progress bars PROGBAR_Horizontal++ HExecuteQuery(QRY_insert1,hQueryDefault,sImporto,sGiorno,sCassa,"") END END
ListDisplay(COMBO_Combobox, taReExecuteQuery) TableDisplay(TABLE_QRY_TabTrasn,taReExecuteQuery) LooperDisplay(LOOP_QRY_TotCassa,taReExecuteQuery) ControlInvisible(PROGBAR_Horizontal,animScrollBottom,50) ToastDisplay("FATTO",toastShort,vaBottom,haCenter)
END
but if the file were bigger I could have problems? are there better methods? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,diciembre 2020 - 10:12 |
marcov avait écrit le 09/12/2020 :
hi, I have a procedure that has to read a txt file of more than 50,000 lines. I currently use this code:
// Read a data file in TXT (import)
sFileContent is string sLine is string sTiporec is string sCodpag is string sCassa is string sImporto is string sGiorno is string
IF EDT_PercFile = "" OR EDT_pagamento="" THEN ToastDisplay("Dati NON Validi",toastLong,vaBottom,haCenter) ELSE // Load the file content in memory ControlVisible(PROGBAR_Horizontal,animScrollBottom,50)
sFileContent = fLoadText(EDT_PercFile)
// Initializes the progress bars to their initial value PROGBAR_Horizontal = PROGBAR_Horizontal..InitialValue
FOR EACH STRING sLine OF sFileContent SEPARATED BY CR // Process the line sTiporec = Middle(sLine, 13, 2) sCodpag = Middle(sLine, 15, 2)
IF sTiporec = "03" AND sCodpag=EDT_pagamento THEN sCassa = Middle(sLine, 7, 2) sImporto = Middle(sLine, 20, 6) sGiorno = Middle(sLine, 65, 14)
// Increments the value of all the progress bars PROGBAR_Horizontal++ HExecuteQuery(QRY_insert1,hQueryDefault,sImporto,sGiorno,sCassa,"") END END
ListDisplay(COMBO_Combobox, taReExecuteQuery)
TableDisplay(TABLE_QRY_TabTrasn,taReExecuteQuery)
LooperDisplay(LOOP_QRY_TotCassa,taReExecuteQuery)
ControlInvisible(PROGBAR_Horizontal,animScrollBottom,50)
ToastDisplay("FATTO",toastShort,vaBottom,haCenter)
END
but if the file were bigger I could have problems? are there better methods?
hello
use fOpen() and fReadLine()
https://doc.windev.com/en-US/…
-- Cordialement JeAn-PhI |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 92 mensajes |
|
| Publicado el 10,diciembre 2020 - 12:13 |
| |
| |
| | | |
|
| | | | |
| | |
|