foreign key results in "show all"

G

greg

Guest
thanks to debbie for the dadabik_sample code - it very clearly shows the construction & use of a table with the foreign key feature.

i am interested in getting the "show all" view to display all linked info based on the foreign key field in a *single* cell within the entire record as opposed to printing the entire record repeatedly with each row having the next "linked info record".

maybe it would be simpler to illustrate with an example. i have two tables:

CREATE TABLE 'main' (
'id' mediumint(8) NOT NULL auto_increment,
'title' varchar(64) NOT NULL default '',
'hist_id' mediumint(8) NOT NULL,
PRIMARY KEY ('id') );

CREATE TABLE 'history' (
'id' mediumint(8) NOT NULL auto_increment,
'main_id' mediumint(8) NOT NULL,
'event_date' date NOT NULL default '0000-00-00',
'event_description' varchar(255) NOT NULL,
PRIMARY KEY ('id') );

The 'history' table contains any number of distinct records containing a running history for each item in the 'main' table.

so to get back to my question, in the "show all" view i wanted to see a single row for each record in 'main' and all the "linked info" from the 'history' table within that same row. for example:

main.title history.date history.description
"Piece 1" "2004-07-01" "history event #1"
"2004-07-02" "history event #2"
"2004-07-03" "history event #3"

i can not see any way within dadabik to configure this, so, unless i am missing something, would it be a complicated endeavor to change the code in business_logic to do this?

tia, greg

 
D

Debbie S

Guest
Greg

Unless I have misunderstood your request, it seems you are looking for a select_multiple type function. The last release of DaDaBIK that included a select multiple was 2.2.1, however, I'm not sure if that function would do what you want - you'd have to test it to see.

Older versions of DaDaBIK are available from SourceForge at http://sourceforge.net/project/showfiles.php?group_id=39649 if you want to test it. Otherwise, Eugenio may have more insight into this issue.

When I have a bit of time, I'll play around with some stuff and see if I can't come up with something.


Debbie
(Latest version of DaDaBIK when this message was posted: 3.1 Beta)
 
E

Eugenio

Guest
greg wrote:

> thanks to debbie for the dadabik_sample code - it very
> clearly shows the construction & use of a table with the
> foreign key feature.
>
> i am interested in getting the "show all" view to display all
> linked info based on the foreign key field in a *single* cell
> within the entire record as opposed to printing the entire
> record repeatedly with each row having the next "linked info
> record".

[....]

No, at the moment it isn't possible to get such a behaviour wihtout big code changes, maybe the old select multiple feature is suitable for you but it wrote the real value of the linked field (and not the ID) in the record.



(Latest version of DaDaBIK when this message was posted: 3.1 beta)
 
Top