How to copy all records of one database in another if both of them are open (COPY FILE not to use) in style with pseudonyms? As in this style the functional analog of the program will look:
SELECT Abs
DBGOTOP()
DO WHILE .NOT. EOF()
Ar := {}
FOR j=1 TO FCOUNT()
AADD(Ar, FIELDGET(j))
NEXT
SELECT InfVisio
APPEND BLANK
FOR j=1 TO LEN(Ar)
FIELDPUT(j,Ar[j])
NEXT
SELECT Abs
DBSKIP(1)
ENDDO
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
*+ Function LB_CopyRecord(cSource,cTarget)
*+
*+ // Copy record to another DBF using Scatter/Gather
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
FUNCTION LB_CopyRecord(cSource,cTarget)
LOCAL i
LOCAL aRpl := {}
SELECT (cSource)
FOR i := 1 TO (cSource)->(fcount())
aadd(aRpl,(cSource)->(fieldget(i))) // load array (scatter) with field data
NEXT
SELECT (cTarget)
(cTarget)->(dbappend())
aeval(aRpl,{|j,i| (cTarget)->(fieldput(i,j)) }) // put data in new record (gather)
RETURN .T.
You could use the dc_gather/dc_scatter but this wouldn't speed it up. I'm wondering if you can use ABS as aliasname, because ABS() is an existing function! This is probably the cause of your syntax errors at compile time.
Absx->(DBGOTOP())
nFields := absx->(fcount()) // fcount() is a slow function
DO WHILE !Absx->(EOF())
FOR j=1 TO nFields // this way the fcount isn't executed each time.
infvisio->(dbappend()) // you need to append a record
InfVisio->(FIELDPUT(j,Absx->FIELDGET(j)))
NEXT
Absx->(DBSKIP(1))
ENDDO
Another way would be to make use of dbeval() but I don't think this would make difference in speed.
As to Abs - very much can be, I will try to understand... Thanks!
Whether and there is something similar Destroy () after DCBROWSE? And I have that one mode with DCBROWSECOL use after one modes or right after start of system works normally, and after others doesn't display base.