add cck fields by group
lelizondob - March 11, 2008 - 00:05
I'm trying to do a content type that can do something like this, I want to add 3 cck fields at the same time to show them inside a node, it could be some sort of a table where you can add a new record with 3 (or more) fields and show them in a node, not a view.
Example:
Node Title: Tasks for Monday
+-----+--------------+---------------+
|#task| assigned to | description |
+-----+--------------+---------------+
| 1 | george | send memo | <----- task
| 2 | paul | call client 1 | <----- task
| 3 | john | buy food | <----- task
+-----+--------------+---------------+This has to be multiple fields, so when I add a new task (record) it shows 3 fields, the #task, assigned to, and description, then if I want to add another group of fields (task) it shows the next 3 fields.
Any Ideas?
Thanks in advance
Luis

I think you are fighting
You say , but I think you are fighting against Drupal. Sounds as though you have already realised that Views could give you a list of tasks, but you don’t say why this isn’t good enough.
If you use a content type task with the fields for one task, node-task.tpl.php:
<tr><td>field 1</td>
...
<td>field n</td>
</tr>
page-task.tpl.php:
...<table>
<thead>header</thead>
<tbody>content</tbody>
</table>
...
You will have much more flexibility.
You would then get lists of tasks using Views or taxonomy or ? which, with a little more work, could be separated into days, if that is what you need.
___________________
It’s in the detaιls…
applications
I could think of three applications for this.
The first one is creating an Invoice. You need at least 3 fields to add the #, Description and Price for every concept in the invoice. We want only one node for every invoice.
The next application is creating a process, in some companies they use sheets with fields to represent every process the company does, something like this:
# | Description of step 1 | Type of Step
I totally agree with you that this could be done with views, but It would be harder to add content... imagine a process of 100 steps, that means adding 100 nodes, 300 fields, select taxonomy 100 times, and 100 submits. If we do it the other way we could have 1 node, 300 fields, select taxonomy only once and 1 submit.
The last application it could be to represent weeks in a football season (or almost any other sport), this way we could have:
Node Title: Week 1
Then in a group of fields we could have
Team 1 | Team 1 Score | VS | Team 2 | Team 2 Score
Cowboys | Cowboys Score | VS | Patriots | Patriots Score
Giants | Giants Score | VS | 49s | 49s Score
Dolphins | Dolphins Score | VS | Cardinals| Cardinals Score
Thanks
Luis
All your ’bases…
I do take your point about ease of inputting, but that reminds me of an April 1st article I saw about write-only memory… What about stock control etc.
I also have a similar problem showing a table, each with tasks which have a goal and a result. And http://drupal.org/node/232184 also.
I’m trying to apply what (little) I know about database design. Drupal insulates us from the actual database itself and provides an abstraction of page & node similar to table & row or query & field set. First of all, you should have the Description and Price of all products in the database already, but that still leaves product (nodereference?), quantity – and the same problem.
I don’t know how cck stores these multiple fields: I assume a separate table with ref#, field_contents. If we could persuade it to do ref#, field_1_contents, field_2_contents, field_3_contents instead of ref#, field_1_contents & ref#, field_2_contents & ref#, field_3_contents we would be close. I think it would be best to implement this independently of field group (a field set?), though it might be possible to extend field group.
Talking of products – what does an e-commerce solution do? Are these independent, but integrated into Drupal?
___________________
It’s in the detaιls…
a single CCK field
I’ve just noticed that http://drupal.org/project/cck_fullname says:
Could this be a way to group fields together, by using a module?
___________________
It’s in the detaιls…
Thanks
I'll give it a try.
Thanks
Luis
solved
I ended up using this great module: http://drupal.org/project/fieldgroup_table. After I installed the module I had to run a query to make it work.
UPDATE system SET weight = 10 WHERE name = 'fieldgroup_table';This module makes the multiple fields looks like a table, this way it's easier to add content and then with views you can show it the way you want.
Thanks.
Luis
I tried this to no effect.
I tried this to no effect. Could you help out here: http://drupal.org/node/206814#comment-954236