Add a third table named something like doc_links.

So you have

activity
----------
id
name

docpool
-----------
id
name
data

doc_links
-------------
id
activity_id
docpool_id

Now in your form, you insert both (you will need a custom
SQLFORM.factory for this). Submit each record, then create a doc_links
with the ids of the two new records.

--
Thadeus





On Tue, Jun 1, 2010 at 8:31 AM, Sverre <[email protected]> wrote:
> The problem is I have 5 tables and each can have many documents per
> entity. I solved this with a table "docpool". For every new entity in
> one of the  5 tables I generate a docpool entity (only the ID) and put
> the docpool.id into the entity. Each document is linked by the
> docpool.id
>
> But now I have a problem with this:
>
> I made a table to log activities. You can store values and documents.
> But I have to store the activity before I can upload any document.  So
> is there a solution without making a 2nd document table?
>
>

Reply via email to