Subject Re: [IBO] Unsure of editablitly in join select
Author Helen Borrie
At 02:40 AM 30-09-02 +0000, you wrote:

>I have applied the KeyRelation, and now I can edit the QTY field,
>but not the PART_ID field. I am assuming that this is because I am
>displaying the PART_NUMBER (through the join) and there is no way
>IBO can go off and retrieve the PART_ID whenever a new PART_NUMBER
>is entered.

Ah...yes, you won't be able to edit the PART_ID field, because it is
controlling the join. move is to either
1) get rid of the join
2) provide your own mechanism to perform DML on the PartQty table

For 1) do the following:

a. Change the SQL of the main dataset to
(select p.PART_NUMBER from Parts p
where p.PART_ID = pq.PART_id) as PartNum,
from PartsQuantity pq

b. In the dataset for your PARTS table query (the one that populates the
lookupcombo) the SQL will be something like

from Parts

-- Set the KeySource property of this dataset to select the ib_datasource
which points to the main dataset
-- Set the KeyLinks property of this dataset to the following:
{{{{ no spaces in this }}}}
-- Set the KeyDescLinks property of this dataset to the following:

Now you have all of the linkages needed to use the lookupcombo as the
selector for PART_ID in the main table.

2. Alternative way to make a joined dataset updatable

--- this is just a general pointer to the technique, since it's not what
you need for this task...

RequestLive simply sets "standard" DML statements for updating one table
and will work for any updatable fields in the KeyRelation of the joined
dataset (as you have discovered).

The alternative is to provide custom SQL to the dataset's InsertSQL,
EditSQL and DeleteSQL properties. For a joined dataset, this will almost
invariably be an EXECUTE call to a stored procedure.

However, in your case here, you can achieve this with an ordinary DSQL
statement, since you only want to update a single table. For example, the
SQL could be:

update PartQty

IBO would pick up the current (edited) value of PART_QTY from the current
row; and you would have to pass a value to PART_ID.
In the handler for the DML operation, you would also need to include this

(This causes the data linker to refetch the row next time it is referred to).

Sorry I can't spare more time right now. Read up the help text and the
Tech Info sheets for deeper detail...