Код: Выделить всё
Interface Test2Table blue;
Var
WhatTable : integer; // 0 - KatMc, 1 - KatUsl
IsStart : boolean;
Create View As Select * From KATMC, KATUSL;
Browse brTwoTables NotableNavigation;
Fields
if(WhatTable = 0, 'МЦ', 'Услуга') 'Table': [10], Protect;
if(WhatTable = 0, KatMC.NRec, KatUsl.Nrec) 'Nrec': [10], Protect;
if(WhatTable = 0, KatMC.Name, KatUsl.Name) 'Name': [60], Protect;
End;
function GoNext : boolean;
{
result := false;
if( IsStart )
{
IsStart := false;
if( WhatTable = 1 )
exit;
if( getfirst katmc = tsok )
{
result := true;
exit;
}
else
{
WhatTable := 1;
if( getfirst katusl = tsok )
{
result := true;
exit;
}
}
}
else
{
if(WhatTable = 0)
{
if( getnext katmc = tsok )
{
result := true;
exit;
}
else
{
WhatTable := 1;
if( getfirst katusl = tsok )
{
result := true;
exit;
}
}
}
if(WhatTable = 1)
{
if( getnext katusl = tsok )
{
result := true;
exit;
}
}
}
}
function GoPrev : boolean;
{
result := false;
if( IsStart )
{
IsStart := false;
if( WhatTable = 0 )
exit;
if( getlast katusl = tsok )
{
result := true;
exit;
}
else
{
WhatTable := 0;
if( getlast katmc = tsok )
{
result := true;
exit;
}
}
}
else
{
if(WhatTable = 1)
{
if( getprev katusl = tsok )
{
result := true;
exit;
}
else
{
WhatTable := 0;
if( getlast katmc = tsok )
{
result := true;
exit;
}
}
}
if(WhatTable = 0)
{
if( getprev katmc = tsok )
{
result := true;
exit;
}
}
}
}
handleevent
cmInit:
{
WhatTable := 0;
IsStart := true;
}
cmDoGetFirst:
{
WhatTable := 0;
IsStart := true;
//if( not GoNext )
// abort;
}
cmDoGetLast:
{
WhatTable := 1;
IsStart := true;
//if( not GoPrev )
// abort;
}
cmDoGetNext:
{
if( not GoNext )
abort;
}
cmDoGetPrev:
{
if( not GoPrev )
abort;
}
End;
End.