Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Search and SET RELATION don't like each other
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Search and SET RELATION don't like each other
Miscellaneous
Thread ID:
00502705
Message ID:
00502705
Views:
68
Hi everybody,

I have form with two grids. The InitialSelectedAlias of DE is set to BldMstr. I want to search Lender table. In the form Init I set relation:

select BldMstr
set relation to left(nvl(lname,oldvalue),1) into Lender
Lender also has a filter set
set filter to status = 'A'
I added two instances of GridHighlighter to highlight records in both grids.

Now, I want to search Lender table and I want to break relations in this case.
I have this code in form Search method:
********************************************************************
*  Description.......: LendRev.Search
*  Calling Samples...: 
*  Parameter List....: 
*  Created by........: Nadya Nosonovsky 05/02/2001 02:31:14 PM 
*  Modified by.......: 
********************************************************************
local lnRecno
lnRecno=recno('Lender')
select BldMstr
set relation to && Temprorarily
thisform.grdLender.SetFocus()
thisform.DataEnvironment.InitialSelectedAlias="Lender" && Search form uses this property
dodefault()
thisform.DataEnvironment.InitialSelectedAlias="BldMstr" && Restore it back
thisform.lJustSearched=.t.
(I manipulated this InitialSelectedAlias because the search form works with it).

This is the code in AfterRowColChange for BldMstr grid:
LPARAMETERS nColIndex
*!*	if !isnull(lName)
*!*	   set relation to left(lname,1) into lender
*!*	else
*!*	   set relation to
*!*	   go top in Lender
*!*	endif   
*!*	dodefault(m.nColIndex)
local lnRecno
lnRecno=recno('BldMstr')
if thisform.lJustSearched
   set relation to
endif    
if not thisform.lJustSearched and empty(set('relation'))
   select BldMstr
   set relation to left(nvl(lName,substr(OldValue,8)),1) into Lender additive
endif   
with this
   .parent.GrdHglt1.Highlight_Row()
   .statusbartext=space(20)+"Record "+ ;
	transform(m.lnRecno)+ ;
	" of "+transform(thisform.NumberOfRecords)+' in '+alias()   
endwith
thisform.navstand.navupdate()
thisform.lJustSearched=.f.
Yet, when I performed my search and return to my form, the relations are set and the record, which I just found, is not shown. Could you please advise, what is wrong here?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform