Hi guys,
Anyone has a code snippet that they are willing to share on how to save and then later on restore SET RELATIONs?
TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
BCC5.82/BCC7.3
xHarbour/Harbour
Hi guys,
Anyone has a code snippet that they are willing to share on how to save and then later on restore SET RELATIONs?
TIA
Check if DbRelation() can be of any help.
EMG
private aHoldRelations := StoreRelation( )
private nHoldRecno := recno()
set relation to
.... do stuff ...
aHoldRelations := RestoreRelation( aHoldRelations )
go recno()
.... code ...
FUNCTION StoreRelation( )
local aRelationStack := {}
local nRelationLevel := 0
do while dbrelation( nRelationLevel+1 ) > " "
aadd( aRelationStack, Relation(++nRelationLevel) )
enddo
return aRelationStack
FUNCTION Relation( nRelation )
RETURN { DBRELATION(nRelation), ;
ALIAS(DBRSELECT(nRelation)) }
FUNCTION RestoreRelation ( aRelationList )
local aRelationLevel := 1
local cExpression := ""
local cWorkAlias := ""
set relation to
do while aRelationList{ aRelationLevel, 1 } > " "
cExpression := aRelationList{ aRelationLevel, 1 }
cWorkAlias := aRelationList{ aRelationLevel, 2 }
dbSetRelation( cWorkAlias, &("{|| "+cExpression+"}"), cExpression)
++aRelationLevel
enddo
return {}