>>>Hi all -
>>>
>>>I confess to lots of embarrassment in asking this question but it's been years since I have used VFP and I just can't remember . . .
>>>I was demoing relationships to a friend and wanted to show him how you can open 2 browse windows and view the child records belonging to the parent table's record. I have done this hundreds of times but can't seem to make it work now. What gives?
>>>My code sample.
>>>
>>>CLOSE TABLES all
>>>SELECT 1
>>>USE segment_master
>>>
>>>SELECT 2
>>>USE countmaster
>>>
>>>SET ORDER TO loc_id
>>>
>>>BROWSE nowait
>>>
>>>SELECT 1
>>>SET RELATION TO loc_id INTO countmaster
>>>
>>>BROWSE nowait
>>>
>>>I expected this to display the records in countmaster as I scroll through segment_master, but the countmaster window comes up empty. What did I miss?
>>>Thanks
>>
>>Check also SET SKIP in VFP Help. I think you've done everything correctly, may be this is what's missing.
>
>Thanks Naomi. I think I found the problem. The expression for the index is complex (LEFT(loc_id,1)+STR(VAL(RIGHT(loc_id,6)))) so it was a simple matter of reindexing on just the loc_id field.
>
>Isn't it a pain getting old?
Not if you look at programming as we did when young. Everything was an adventure. How can this be better? How can that be faster? The excitement in reducing lines of code, making the code more elegant and modern never gets old. :)
CLOSE TABLES all
USE segment_master in 0
USE countmaster order tag loc_id in 0
SELECT segment_master
SET RELATION TO (LEFT(loc_id,1)+STR(VAL(RIGHT(loc_id,6)))) INTO countmaster
BROWSE nowait
I don't usually name an index loc_id unless it only involves the field. I try to indicate a complex expression in the tag's name.