Subject Re: [IBO] Two editable and indexed columns from two tables
Author Gerard J.M.Houtenbos
First of all, thanks for your response, Raymond, Marco and Helen.

I worked things out using the join.

>If you take the join approach, your main dataset's query would be:
>
>SELECT Players.P_Key, Players.Name, Players.CaptainKey
> Captains.P_Key, Captains.Name
>FROM Players
>JOIN Captains
>ON Players.CaptainKey = Captains.P_Key
>
>The KeyLinks here would be:
>
>Players.P_Key
>Captains.P_Key
>
>For the lookup dataset, your query would be
>
>Select P_Key, Name
>from Captains
>Order by Name
>
>Just use KeyLinksAutoDefine and Requestlive for this query.

I suppose the Requestlive-setting is required for both the
queries.

If I put this to an InfoPower grid with the columns Players.Name
and Captains.Name neither one is editable.

When I set the KeyRelation property of the main-query to Players
and remove the 'Captains.P_Key' from the KeyLinks-property, then
the column Players.Name is editable.

>If you are permitting the Captains data in the lookupcombo to be editable,
>then you will have to do several things to make the main dataset
>respond.
I don't need to edit the Captains data, but I need to be able to
change the captain for a player. So I use a TwwDbLookupCombo to
let the user select another captain. In the OnChange-event of the
Captains.Name column I need to set the Players.CaptainKey to the
current Captains.P_Key (selected in the lookupcombo).

After this the order is invalid so I have to refresh the query.

So far so good. But now the ordering-problem.
Because the two queries both have a field NAME, setting
OrderingItemNo results in an exception stating the ambiguous
reference.
Also the use of a different displayname doesn't solve this.
NAME=NAME;NAME DESC
C_NAME=C_NAME;C_NAME DESC

Is the only solution to rename one of the fields in the database?

Thanks,

Gerard


_________________________

Gerard J.M. Houtenbos
DoubleWood Software