Subject RE: [IBO] Updating left outer join
Author Roger Vellacott
Paul, for what it's worth..

CREATE PROCEDURE DO_NOTHING AS
BEGIN
END


Q:TIB_Cursor;

Q.SQL.Text := 'SELECT A.*, B.JOINED_FIELD FROM TA A LEFT OUTER JOIN TB B
ON B.ID = A.ID';
Q.RequestLive := True;
Q,KeyLinks.Text := TA.ID;
Q.EditSQL.Text := 'EXECUTE PROCEDURE DO_NOTHING';
Q.Active := True;
for i := 0 to Q.FieldCount-1 do
Q.Fields[i].PreventEditing := False;
Q.Edit;
Q.FieldByName('JOINED_FIELD').AsString := 'this makes a joined field
editable';
Q.Post;

You can put what you like into EditSQL, or run a load of queries in the
BeforePost event of Q.

Roger Vellacott
Passfield Data Systems Ltd





-----Original Message-----
From: Paul Hope [mailto:paulhope@...]
Sent: 06 June 2006 17:06
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] Updating left outer join



Hi Geoff, hope all is well with you

_____

From: IBObjects@yahoogrou <mailto:IBObjects%40yahoogroups.com> ps.com
[mailto: IBObjects@yahoogrou <mailto:IBObjects%40yahoogroups.com>
ps.com] On Behalf
Of Geoff Worboys
Sent: 05 June 2006 23:54
To: IBObjects@yahoogrou <mailto:IBObjects%40yahoogroups.com> ps.com
Subject: Re: [IBO] Updating left outer join

Hi Paul,

> I have this query connected to a grid
> select s.rec,s.shipment,s.whs,s.pid,s.qty,s.alloc,w.description
> from (warehouses w left outer join shipment_allocations s
> on s.whs=w.ref and s.shipment=:shipment and s.pid=:pid)

I can sort of see what you are doing here. You want all the
warehouses regardless of shipment allocation, but you want to
filter what shipment allocations get displayed.

Yes, a bit like having a pre-printed form with all the warehouses down
the
left hand side regardless of other columns.

Notice that one of the things you have here are fields and
parameters with the same name! This is normally OK, but when
IBO is matching output parameters for editsql etc how does it
know whether you want the pid field or the pid parameter?
(Indeed, which do you want?)

Fair point - except that the field and parameter have the same value so
IBO
might have given it a try ;-)

In IBO I suggest that it is good practice to keep your param
names different to your field names, that way you can see more
clearly the results of what IBO is going through its various
SQL automation.

I'll bear that in mind.
Having solved this with OnCustomEdit and a dummy SQLinsert I havent got
time
to wind it back or set up a test at the moment.. .

I suggest a selectable stored procedure. One of the tricks
that you can do with a selectable stored procedure is to
return one or more of the input parameters as a field value.
Having returned such a value it becomes useable as a field in
IBO's automatic matching for editsql etc.

but I will give it a bash sometime.

Thanks for the ideas

Regards
Paul


[Non-text portions of this message have been removed]