Grids with more than one recordsource? 
Author Message
 Grids with more than one recordsource?

Is there a way to have a single grid display information from a parent table
in the first column and related information from a child table in a second
column.

For example, a member's name in the first column (from the members' table)
and the name of the member's employer in the second column (employers'
table).  The members' table contains only the employer number and the
employer name is retrieved from the employers' table with a relation.

Thx
Stephen



Thu, 20 Feb 2003 09:31:49 GMT  
 Grids with more than one recordsource?

Stephen
Yes, you can, in several ways. If you have relational link established with
the Employer table as child you up  ColumnCount to create a column for the
employer's name, then enter Employer.name as that column's ControlSource.
you can do with the Grid Builder; it's got a relation dialogue.
You can also, with or without a relation. enter an expresssion as the new
column's Controlsource: LOOKUP(Employers.name, member.keyfield,
employer.keyfield).
Programmatically done
Function grid Init
with this
.columncount=.columncount+1
.Columns(.columncount).name='colEmployer'
.colEmployer.controlsource= ;
"LOOKUP(Employers.name, member.keyfield, employer.keyfield) "
.colEmployer.columnorder=2
.colemployer.header1.caption='Employer'
Endwith

The third way is to create a local view, parameterized so you can easily
make a filtering of members, with the columns you want in a join of the
Members and Employers tables and then use the view as RecordSource.
Recommended.
-Anders


Quote:
> Is there a way to have a single grid display information from a parent
table
> in the first column and related information from a child table in a second
> column.

> For example, a member's name in the first column (from the members' table)
> and the name of the member's employer in the second column (employers'
> table).  The members' table contains only the employer number and the
> employer name is retrieved from the employers' table with a relation.

> Thx
> Stephen



Thu, 20 Feb 2003 18:32:19 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Changing the Grid's RecordSource Property

2. I lost a grid's recordSource...continued..

3. SELECT in grid.Recordsource always appears

4. Grid RecordSource

5. Refreshing Grid with Cursor as RecordSource?

6. Grid's recordsource problem

7. SQL VIEW in grid's RecordSource question

8. Grid RecordSource

9. Updating GRID recordsource

10. The Grid problems with changing recordsource at runtime

11. Change Recordsource of Grid at Runtime

12. grid.recordsource bugged?

 

 
Powered by phpBB® Forum Software