browse two tables in relation with SQL
Posted: Tue Nov 28, 2017 12:46 pm
Hi,
I still work on relation between two tables (DBF Visual Foxpro) opened with VFP ODBC driver and SQL express.
Actually status :
On screen I have two browsers (with DCBROWSE),
when move to some row on first table record move to same identifier on second table, this works with my created code block here :
bOLPD:={|pomcislo1,pomcislo2|;
pomcislo1:={oCursorolp:fieldget(1)},; // ako číslo
pomcislo2:=alltrim(str(oCursorolp:fieldget(1))),; // ako text
cStatementpd := 'SELECT C_PROC,DAVKA,DAT_ZAD,CAS_ZAD,STAV,NAZPTK FROM RAUKN_OLP_D.DBF WHERE C_PROC='+
(pomcislo2)+' ORDER BY C_PROC ',;
oCursorolpd:close(),;
oCursorolpd := CreateSQLCursor( oConnectionpd, 4, cStatementpd ),;
oBrowsed:refreshall(),;
oCursorolpd:GoTop(),;
DC_GETREFRESH(GETLIST),tone(200,1) ; // refresh prostredia
}
In DCBROWSE for first table is used here
@ 0,0 DCBROWSE oBrowse ALIAS "OLP" DATA oCursorolp ;
SIZE 150,15 ;
PRESENTATION DC_BrowPres() ;
CURSORMODE XBPBRW_CURSOR_ROW ;
ITEMMARKED {||Eval(bOLPD), ;
DC_GetRefresh(GetList,, ;
DCGETREFRESH_TYPE_EXCLUDE,(GETLIST_BROWSE))}
Problem is , that in second table show only one record (for one record in table 1 exist 0,1,2, or n record in table 2 )
No refreshall, gotop etc works, only one record show.
when move in table 2 with ocursorolp:skip(1), skip record and show again only one record.
when try reccount() in table 2, show correct numbers of records.
I do not why ???
On pictures is what show after positioning in table 1, and at pict2 after skip(1).
Please, some idea to solve it ??? many thanks ...
Viktor
I still work on relation between two tables (DBF Visual Foxpro) opened with VFP ODBC driver and SQL express.
Actually status :
On screen I have two browsers (with DCBROWSE),
when move to some row on first table record move to same identifier on second table, this works with my created code block here :
bOLPD:={|pomcislo1,pomcislo2|;
pomcislo1:={oCursorolp:fieldget(1)},; // ako číslo
pomcislo2:=alltrim(str(oCursorolp:fieldget(1))),; // ako text
cStatementpd := 'SELECT C_PROC,DAVKA,DAT_ZAD,CAS_ZAD,STAV,NAZPTK FROM RAUKN_OLP_D.DBF WHERE C_PROC='+
(pomcislo2)+' ORDER BY C_PROC ',;
oCursorolpd:close(),;
oCursorolpd := CreateSQLCursor( oConnectionpd, 4, cStatementpd ),;
oBrowsed:refreshall(),;
oCursorolpd:GoTop(),;
DC_GETREFRESH(GETLIST),tone(200,1) ; // refresh prostredia
}
In DCBROWSE for first table is used here
@ 0,0 DCBROWSE oBrowse ALIAS "OLP" DATA oCursorolp ;
SIZE 150,15 ;
PRESENTATION DC_BrowPres() ;
CURSORMODE XBPBRW_CURSOR_ROW ;
ITEMMARKED {||Eval(bOLPD), ;
DC_GetRefresh(GetList,, ;
DCGETREFRESH_TYPE_EXCLUDE,(GETLIST_BROWSE))}
Problem is , that in second table show only one record (for one record in table 1 exist 0,1,2, or n record in table 2 )
No refreshall, gotop etc works, only one record show.
when move in table 2 with ocursorolp:skip(1), skip record and show again only one record.
when try reccount() in table 2, show correct numbers of records.
I do not why ???
On pictures is what show after positioning in table 1, and at pict2 after skip(1).
Please, some idea to solve it ??? many thanks ...
Viktor