Subject Re: [IBO] When is KeyRelation necessary?
Author Nando Dessena
Hi Helen,

> >I am using a TIBOQuery with a somewhat complex SQL statement (a left
> >join and a "where exists" clause). The dataset is not editable unless I
> >set KeyRelation. I thought that it was required when using implicit join
> >syntax only, while I am using explicit syntax.
>
> You are getting confused with JoinLinks, I think.

That may very well be. Perhaps I should have RTFM, which describe it
all. :-(
To sum up:
- to have an editable dataset with a join you always need to set
KeyRelation, no matter which syntax you use for the join.
- if you use implicit join syntax, you also need to set JoinLinks.
- in every case you need KeyLinks (or KeyLinksAutoDefine where
possible).

> >The query is something like that:
> >
> >select a.*, b.id
> >from a left join b on (a.id = b.id)
> >where exists (select s.id from some_stored_procedure(:a_param) s where
> >s.id = a.id)
> >order by a.id
> >
> >I have set KeyLinks to 'a.id', and thought that would be enough.
> >Setting KeyRelation to 'a' does work well, so it's not really an issue
> >for me, just a curiosity.
>
> What does it *do* when it "works well"?

I should have been more specific. It makes the dataset updateable, ie it
generates the update instructions all of its own, which is a big win for
me compared to the clumsy TUpdateSQL I used to have on that data module.
:-)
Thanks
--
____
_/\/ando