fbreschi
Posts: 3
|
| Posted: 02/11/2007, 12:25 PM |
|
Dear All,
I'm trying to use an editable grid as follows:
-------------------------------------------------------
| image_id | name | customer | catalog | page |
-------------------------------------------------------
Where image_id->Label, name->Label, customer+catalog+page->Listbox. The base table is named "import"
Customer is father to catalog, catalog to page, so I have the relations each one having referential integrity attributes.
I'm willing to build the editable grid to behave as follows:
1) Customer is choosen (listbox), then update
2) Catalog is choosen dipending on what customer was choosen in (1), update
3) Page is choosen as per what choosen in (1) (2), update
This way, I could get full control of master-detail relationships just in one line...
The SQL made by myself with the bulder is something like:
SELECT catalogs.name AS catalogs_name, catalogs.id AS catalogs_id, import.id AS import_id
FROM catalogs INNER JOIN (import INNER JOIN customers ON
import.customer = customers.id) ON
catalogs.parent = customers.id
GROUP BY import.id, catalogs.id, catalogs.name
ORDER BY import.id
As you can see, the join works out nicely all the tuples, despite the fact that I have no possibility to insert a HAVING clause at the bottom, this of course I guess it can be done via manual editing.
The problem I have is that the Listboxes return the result of the whole join, I'd need to get just the catalogues owned by a particular user etc.
The question is: Do I have any possibility to obtain that? provided that:
This code is "table" oriented:
$import->{catalog}->{DataSource}->{SQL} = "SELECT catalogs.name AS catalogs_name, catalogs.id AS catalogs_id, import.id AS import_id \n" .
"FROM catalogs INNER JOIN (import INNER JOIN customers ON\n" .
"import.customer = customers.id) ON\n" .
"catalogs.parent = customers.id WHERE import.id={customer} \n" .
"GROUP BY import.id, catalogs.id, catalogs.name {SQL_OrderBy}";
I need a "tuple" oriented code so that, for every single line returned by the query I have the possibility to modify the associated listbox to "catalog" belonging only to the respective customer, that's why I'm talking about "impedance mismatch"
If possible, where can I insert it the code? what are the involved variables? any examples around?
If not possible, I'd need to revert to Grid/record design, just one record per grid and perhaps I'd have a chance to accomplish it?
Many thanks indeed in advance.
Fabian
|
 |
 |
|