Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Search and SET RELATION don't like each other
Message
From
03/05/2001 10:28:26
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00502705
Message ID:
00503013
Views:
18
This message has been marked as the solution to the initial question of the thread.
Hi!

>>Hi!
>>
>>When you search in the child table, you require to move record in the parent table in order to show child record after you restore relation. Yet I see nothing in your code that move record pointer in the parent table (BldMstr) after you find record in the child table. Even if the record you find is the record witrh the same parent record, you should use 'Go recno("BldMstr") in BldMstr' after settiung a relation to apply this relation to the child table. After this, however, record pointer in the child table will move to the first record from the range for parent table, thus you require to remember it before this and than restore to show it properly in the child grid.
>>
>>As about question how this could be done by another way: this could be done using a lot of different ways. Examples:
>>
>>SET FILTER instead of relation.
>>SET KEY instead of relation (will be the best replacement in your case because you already use filter)
>>Using of the parametrised view. Will be somewhat slower, but is not as important as development time and maintenance - this way requires more time.
>>
>>HTH.
>
>Hi Vlad,
>
>First of all, thanks for looking into this thread. I just tried SET KEY, but I could not make it work. If I'll use parameterized view, it will mean, what grid will reconstruct each time, right? Of course, I can try your idea of avoiding grid reconstruction. I may try filter idea. The Lender table contains only ~1000 records, so I dont' think, it would be a significant delay.
>
>Anyway, strange, why I can't use SET KEY. This is how I tried it:
>GrdBldMstr.AfterRowColChange
>
>select BldMstr
>lcKeyValue=left(nvl(lName,substr(OldValue,8)),1)
>*!*	if thisform.lJustSearched
>*!*	   set key to in Lender
>*!*	endif
>*if not thisform.lJustSearched
> set key to m.lcKeyValue in Lender
>
>*endif
>
>It shows only one record and it doesn't change, when I navigate between records. I want to show all records in Lender, which starts from the specific letter, say, all records with first letter F in Lender.Short. Lender uses short as order, and I set exact off.
>

Lender grid should be refreshed after change of the 'SET KEY'. SET FILTER requires this too...
*if not thisform.lJustSearched
 set key to m.lcKeyValue in Lender
 GrdLender.Refresh && refresh the Lender grid
*endif
I cannot beleive SET KEY does not work because it is such kind of the filter that works over indexes. Maybe index is corrupted? It also allows to specify a range, bounds of the range could equal - try this syntax. I remember I used this approach in a FPD 2.6 and it worked great with DOS browse windows.

Well, you do not require view, just a select statement if this table is not editable ;)
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform