use fw_arraytodbf with conditions
Posted: Sat Sep 17, 2022 10:35 am
I have an array previously built from a txt file, in this array as the first field there is a date field, I have to convert this array into a dbf file all records if the date field (dUltimaData) is greater than the last passed date
oTemp:= TDatabase():Open( , cPath+"LOTTO", "DBFCDX", .T. )
oTemp:gobottom()
dUltimaData:=oTemp:data
olotto2:= TDatabase():Open( , cPath+"STORICO", "DBFCDX", .T. )
SET DELETED ON
olotto2:setorder(0)
oLotto2:gotop()
//FW_ArrayToDBF( aData, cFieldList, bProgress, lOverWrite, lRecallDeleted, bTrigger )
oLotto2:fw_ArrayToDBF( aData,,bProgress) // how insert conditions ?
I need to create it because when I update the archive the old procedure deletes all the archive and re-insert all the records while it should only add the new records which then if the extraction is not updated is only one the records are only 11 and therefore the end user does not have to wait a long time to update the archive
I tried to create a new array with only the records need to me
oTemp:= TDatabase():Open( , cPath+"LOTTO", "DBFCDX", .T. )
oTemp:gobottom()
dUltimaData:=oTemp:data
For n= 1 to len(aData)
If ctod(aData[1][n]) > dUltimaData
AaDd(aNewData,{aData[1][n],;
aData[2][n],;
aData[3][n],;
aData[4][n],;
aData[5][n],;
aData[6][n],;
aData[7][n]})
Endif
Next
but make me error
wich is 8 ?
oTemp:= TDatabase():Open( , cPath+"LOTTO", "DBFCDX", .T. )
oTemp:gobottom()
dUltimaData:=oTemp:data
olotto2:= TDatabase():Open( , cPath+"STORICO", "DBFCDX", .T. )
SET DELETED ON
olotto2:setorder(0)
oLotto2:gotop()
//FW_ArrayToDBF( aData, cFieldList, bProgress, lOverWrite, lRecallDeleted, bTrigger )
oLotto2:fw_ArrayToDBF( aData,,bProgress) // how insert conditions ?
I need to create it because when I update the archive the old procedure deletes all the archive and re-insert all the records while it should only add the new records which then if the extraction is not updated is only one the records are only 11 and therefore the end user does not have to wait a long time to update the archive
I tried to create a new array with only the records need to me
oTemp:= TDatabase():Open( , cPath+"LOTTO", "DBFCDX", .T. )
oTemp:gobottom()
dUltimaData:=oTemp:data
For n= 1 to len(aData)
If ctod(aData[1][n]) > dUltimaData
AaDd(aNewData,{aData[1][n],;
aData[2][n],;
aData[3][n],;
aData[4][n],;
aData[5][n],;
aData[6][n],;
aData[7][n]})
Endif
Next
but make me error
Code: Select all | Expand
Error occurred at: 17-09-2022, 12:56:24
Error description: Error BASE/1132 Bound error: array access
Args:
[ 1] = A {"07/01/1939","BA","58","22","47","49","69"} length: 7
[ 2] = N 8
wich is 8 ?