Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form with pageframe and 2 grids issue
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01479583
Message ID:
01479588
Views:
29
>>>Hi,
>>>
>>>I am trying to figure out how to deal/solve the following issue.
>>>
>>>I have a form with a pageframe, two pages. Page 1 has a grid and Page 2 has a grid. Page 1 has records in a parent table. Page 2 has records in child table. When user clicks on Page 2 the program selects records from the child table (according to the current record in the parent table) and shows them in the grid (on Page 2). The problem is that when user clicks on Page 2 - the very first time - the grid on Page 2 shows, what seems to be, as many records (all the same) of the child table as there are records in the parent table. But when user clicks on Page 1 and then back on Page 2, the grid on Page 2 shows correct number of records. So it seems that the grid on Page 2 has to be 'build' first time in order for it to work correctly.
>>>
>>>Note that the grid on Page 2 is built dynamically based on some meta table. And I checked - before and after calling the routine that builds the grid (on Page 2) that the cursor of child table has correct number of records.
>>>
>>>Does it make sense? Any suggestions? TIA.
>>
>>What are you using to display your records? CA with parameter, local view, tables with relations (that may be the wrong case)?
>>
>>If the latter, make sure to move the record pointer in the parent table to re-enforce the relationship.
>
>I don't quite understand your question. But let me clarify. There is no relationship between parent and child table. The Child table cursor is populated with a CA but not with parameters but rather with SelectCmd that selects records from child table that match PK value of the parent table. Note, as I said, the child table cursor has the right number of records selected (retrieved from SQL Server) but the grid still shows many, many more. That is, the issue seems to be not with the cursor but with the way grid works.
>
>As I am typing this reply I think I may found the solution. I will set alias of the child table cursor to the grid on Page 2 when instantiating the form. Hopefully this will solve the problem.

Why do you need different SelectCmd if you can have CA with a parameter and just use CursorRefresh() when changing a parent (if you don't want to change fields of the child each time parent changes)?

If so, you can set up your grid once (in the Init of the form) and you will not have a need to re-build the grid every time.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform