compile function relational_call2( Table, KeysColumn, Key, Popup, TargetTable, SortBy )
begin condition
pre:
post:
end condition
$insert logical
$insert popup_equates
$insert msg_equates
equ CrLf$ to char(13):char(10)
declare function msg, entid, popup, key_sort, repository

* the only difference between this function and relational_call
* is that this will not automatically take the user to the window
* when no hits are found

Choosen = ''
KeyList = xlate( Table, Key, KeysColumn,'X' )
if KeyList then
    convert @vm to @fm in KeyList
    KeyList = key_sort( KeyList, TargetTable, SortBy, 1, '', '' )
    convert @fm to ' ' in KeyList
    PopupRec = xlate( 'SYSREPOSPOPUPS', @appid<1>:'**':Popup, '', 'X' )
    PopupRec<pdisplay$> = KeyList
   	Choosen = popup( @window, PopupRec )
    if Choosen = '' then
       StartMessage = ''
       gosub UserGoToWin
    end
end else
    StartMessage = 'There were no records found...':CrLf$
    gosub UserGoToWin
end
return Choosen
*============================================================================*
UserGoToWin:
	Fchar = TargetTable[1,1]
	Rest  = TargetTable[2,999]
	convert @upper_case to @lower_case in Rest
	TableOut = Fchar:Rest
	MsgInfo = ''
	MsgInfo<micon$> = '?'
	MsgInfo<mtext$> = StartMessage:'Do you wish to go to the ':TableOut:' window?'
	MsgInfo<mtype$> = 'BNY' 
	Yn = msg( '', MsgInfo )
	if Yn then
	    Choosen = 'NoKeys'
	end else
	    Choosen = ''
	end
return
*============================================================================*

