Discussion:
Database views
(too old to reply)
CM
2004-09-23 22:51:02 UTC
Permalink
I built my database with four tables linked via inner joins. Each table has
a primary key associated with it. When I build a view using fields from all
four tables, can I use the INDEX command on the view? Can I open another
database view, index it and SET RELATION to the first one based on this index?

Thank you very much,

CM
Stefan Wuebbe
2004-09-24 06:17:54 UTC
Permalink
Post by CM
I built my database with four tables linked via inner joins. Each table has
a primary key associated with it. When I build a view using fields from all
four tables, can I use the INDEX command on the view?
Yes.
(Indexing views only works temporarily at runtime though.)
Post by CM
Can I open another
database view, index it and SET RELATION to the first one based on this index?
Yes.
(But Set Relation may not work as reliable as a multi-join,
in Vfp grids for example.
Alternatively you could just create another view joining all
tables together.)


hth
-Stefan
CM
2004-09-25 01:07:02 UTC
Permalink
Thanks. Why might the SET RELATION not be as reliable?

CM
Post by Stefan Wuebbe
Post by CM
I built my database with four tables linked via inner joins. Each table has
a primary key associated with it. When I build a view using fields from all
four tables, can I use the INDEX command on the view?
Yes.
(Indexing views only works temporarily at runtime though.)
Post by CM
Can I open another
database view, index it and SET RELATION to the first one based on this index?
Yes.
(But Set Relation may not work as reliable as a multi-join,
in Vfp grids for example.
Alternatively you could just create another view joining all
tables together.)
hth
-Stefan
Stefan Wuebbe
2004-09-25 09:07:31 UTC
Permalink
Post by CM
Why might the SET RELATION not be as reliable?
That's a good question. I'd say Set Relation is more complicated because
there are more things to care for - two or more record pointers, child index,
grid's "link masters" and the relations themselves.
In practice Vfp grids seem to handle views (representing several Joined
tables) better - newsgroups are full of questions about Set Relation not
immediately working in grids.
Dataenvironments containing only one or three views are much easier to
maintain than those containing some ten tables + relations.


hth
-Stefan
Post by CM
Thanks. Why might the SET RELATION not be as reliable?
CM
Post by Stefan Wuebbe
Post by CM
I built my database with four tables linked via inner joins. Each table has
a primary key associated with it. When I build a view using fields from all
four tables, can I use the INDEX command on the view?
Yes.
(Indexing views only works temporarily at runtime though.)
Post by CM
Can I open another
database view, index it and SET RELATION to the first one based on this index?
Yes.
(But Set Relation may not work as reliable as a multi-join,
in Vfp grids for example.
Alternatively you could just create another view joining all
tables together.)
hth
-Stefan
Leonid
2004-09-26 12:24:39 UTC
Permalink
Hi
Post by Stefan Wuebbe
In practice Vfp grids seem to handle views (representing several Joined
tables) better - newsgroups are full of questions about Set Relation not
immediately working in grids.
There is a simple workaround for this issue. I put

select 0
select (Alias that is used in grid)

in the Activate method of the page where the grid resizes. This reactivates
relations

Leonid
CM
2004-09-28 16:53:02 UTC
Permalink
I have views open in three work areas, then I index them and set relations
between them before doing some work (replace statements moving data between
databases). Does this accomplish what you're describing?

Thanks,

CM
Post by Leonid
Hi
Post by Stefan Wuebbe
In practice Vfp grids seem to handle views (representing several Joined
tables) better - newsgroups are full of questions about Set Relation not
immediately working in grids.
There is a simple workaround for this issue. I put
select 0
select (Alias that is used in grid)
in the Activate method of the page where the grid resizes. This reactivates
relations
Leonid
Leonid
2004-09-29 07:03:52 UTC
Permalink
If you don't use grids, all this is acceptable, but if you put such a data
in grid, sometimes you will see your data as if there is no relations at
all. I tried to describe how one can bypass this problem

Leonid
Post by CM
I have views open in three work areas, then I index them and set relations
between them before doing some work (replace statements moving data between
databases). Does this accomplish what you're describing?
Thanks,
CM
Post by Leonid
Hi
Post by Stefan Wuebbe
In practice Vfp grids seem to handle views (representing several Joined
tables) better - newsgroups are full of questions about Set Relation not
immediately working in grids.
There is a simple workaround for this issue. I put
select 0
select (Alias that is used in grid)
in the Activate method of the page where the grid resizes. This reactivates
relations
Leonid
CM
2004-10-06 03:11:03 UTC
Permalink
Thank you. I don't use grids, so I think my work is okay.

CM
Post by Leonid
If you don't use grids, all this is acceptable, but if you put such a data
in grid, sometimes you will see your data as if there is no relations at
all. I tried to describe how one can bypass this problem
Leonid
Post by CM
I have views open in three work areas, then I index them and set relations
between them before doing some work (replace statements moving data
between
Post by CM
databases). Does this accomplish what you're describing?
Thanks,
CM
Post by Leonid
Hi
Post by Stefan Wuebbe
In practice Vfp grids seem to handle views (representing several
Joined
Post by CM
Post by Leonid
Post by Stefan Wuebbe
tables) better - newsgroups are full of questions about Set Relation
not
Post by CM
Post by Leonid
Post by Stefan Wuebbe
immediately working in grids.
There is a simple workaround for this issue. I put
select 0
select (Alias that is used in grid)
in the Activate method of the page where the grid resizes. This
reactivates
Post by CM
Post by Leonid
relations
Leonid
CM
2004-09-28 16:49:04 UTC
Permalink
Thanks again. I've been opening three views in work areas A, B and C, then
setting relations between A and B, performing some work, then between A and C
and performing some work. The purpose is to bring field values from a base
table in one database into a base table in another data base. Everything
seems to work fine.

I was not able to find documentation in the help files that expressly stated
I could index views and set relations between them, that's why I originally
posted my question.

I appreciate your taking the time to reply,

CM
Post by Stefan Wuebbe
Post by CM
Why might the SET RELATION not be as reliable?
That's a good question. I'd say Set Relation is more complicated because
there are more things to care for - two or more record pointers, child index,
grid's "link masters" and the relations themselves.
In practice Vfp grids seem to handle views (representing several Joined
tables) better - newsgroups are full of questions about Set Relation not
immediately working in grids.
Dataenvironments containing only one or three views are much easier to
maintain than those containing some ten tables + relations.
hth
-Stefan
Post by CM
Thanks. Why might the SET RELATION not be as reliable?
CM
Post by Stefan Wuebbe
Post by CM
I built my database with four tables linked via inner joins. Each table has
a primary key associated with it. When I build a view using fields from all
four tables, can I use the INDEX command on the view?
Yes.
(Indexing views only works temporarily at runtime though.)
Post by CM
Can I open another
database view, index it and SET RELATION to the first one based on this index?
Yes.
(But Set Relation may not work as reliable as a multi-join,
in Vfp grids for example.
Alternatively you could just create another view joining all
tables together.)
hth
-Stefan
Loading...