Subject | Re: [IBO] OnDataChange and refreshing data in query linked with KeySource |
---|---|
Author | tomjanczkadao |
Post date | 2007-08-09T09:37:05Z |
>event in
> Are you talking about the timing of the firing of the OnDataChange
> relation to the timing of when the linking relationship to the otherside of
> the KeyLinks relationship?and tell
>
> Perhaps you could send me a sample application showing how it works
> me how you want it to work. I'll see if there is something in IBOthat I
> can adjust to get more ideal timing of events.i've sent example at @... and piece of sample code
>
> Jason Wharton
>
there:
table USERS:
NAME CITY(fk)
Alan Miami
Frank Miami
Greg San Francisco
John Los Angeles
table CITIES:
CITY STATE
Houston Texas
Los Angeles California
Miami Florida
San Francisco California
procedure TForm1.FormCreate(Sender: TObject);
begin
conn.Connect;
qUsers.SQL.Text := 'SELECT name, city FROM users';
qUsers.Open;
qCities.SQL.Text := 'SELECT city, state FROM cities';
qCities.KeySource := dsUsers;
qCities.KeyLinks.Text := 'city=city';
qCities.Open;
end;
procedure TForm1.dsUsersDataChange(Sender: TIB_StatementLink;
Statement: TIB_Statement; Field: TIB_Column);
begin
if qCities.Active and qUsers.Active then
ShowMessage(qCities.FieldByName('city').AsString + #13#10 +
qUsers.FieldByName('city').AsString);
{
if I scroll qUsers from John (Los Angeles) to Alan (Miami)
Showmessage says:
"Los Angeles
Miami"
but it should be same value "Miami"
So if i check field 'State' from 'Cities' it'll return incorect value
}
end;
Regards, Tomek