I've run the below test code using xBuildW beta 8.3 on Windows ( XP Pro SP3
).
There is a relation set up between two tables:
- both tables are indexed on a column with character data type (NAME)
- the child table's active index (NAME) includes some empty fields
- the parent table's active index is NAME
When a DBSeek(...) is performed in the parent table, and the key doesn't
exist in the parent table,t the child table's row pointer is positioned on
the record, which contains the first empty field value of the active index,
and Found() returns TRUE.
Ella
function main()
local i
local astru:={ { "ID", "C", 2, 0 }, ;
{ "NAME", "C", 4, 0 } }
dbcreate( "parent", astru, , NIL )
dbcreate( "child", astru, , NIL )
dbusearea( .f., , "child.dbf", "child", .T., .F. )
for i:=1 to 10
dbappend()
replace id with strzero( i, 2 ), ;
name with if( i>7, "", strzero( i, 4 ) )
next
ordcreate( , "k_name", "name", { || name } )
dbselectarea( 0 )
dbusearea( .f., , "parent.dbf", "parent", .T., .F. )
for i:=1 to 10
dbappend()
replace id with strzero( i, 2 ), ;
name with strzero( i, 4 )
next
ordcreate( , "k_name", "name", { || name } )
dbsetrelation( "child", { || name }, "name" )
dbskip(0)
mytest( "0005" ) // both parent and child exist
mytest( "9999" ) // parent doesn't exist
mytest( "0009" ) // parent exists, child doesn't exist
dbcloseall()
wait "------ end test..."
return NIL
function mytest( cKey )
? "------- Key = " + cKey
parent->( dbseek( cKey ) )
? "parent eof() " + if( parent->(eof()), "TRUE", "FALSE" )
? "parent found() " + if( parent->(found()), "TRUE", "FALSE" )
? "parent recno() " + str( parent->(recno()) )
? "child found() " + if( child->(found()), "TRUE", "FALSE" )
? "child recno() " + str( child->(recno()) )
? "child->name " + child->name
return NIL
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
xHarbour-developers mailing list
xHarbour-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xharbour-developers