Hi & welcome!
Firstly...
PS: Is there a way to edit code fragments within cook? Or do I need to download it all the time and merge it again and again? Sorry for being a newbie.
Yes, you will need to add custom code after download as you said then merge with any editions you make in the builder.
I guess I could let the user create the document first and then select it in the other view. But a) bad usability and b) I could only select 1 document.
Really speaking you would be better off taking this approach to maintain a normalised dataset. I mean, you don't want to have to have multiple fields for files in a table just to allow users to store multiple related files for a record, right?
I would create something like;
- files table - with id, title, file
- foo table - with whatever fields you like then use a join table like;
- foo_files where you store just 2 foreign keys - files.id + foo.id
This way, you can have as many (or no files) associated with a
foo record as you like. Similarly, you could take this approach for any other tables you wish to link files to.
Then, to display the data (views and layouts), you will need to do some custom work such as
- using redirects to step-by-step through creation and re-use parameters AND/OR
- ajax and loading necessary forms/data according to options selected by the user
Much of the calling related data into a view/layout can be done inside COOK as you have access to drill-down and select fields from related tables when using foreign keys. Also, there are a number of posts on getting & displaying related info if you have a quick search around.
Hope this helps,
Gez