Rules create multiple child nodes with referencing to a parent node, based on CCK value

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
maxplus's picture

Hi,

I'm trying to learn the Drupal techniques quick but even with reading a lot in the Drupal.org, Drupal groups and watching screencast, I can not manage to get one thing done with Rules.
I'm sure it is possible, hopefully somebody can help me with this.

This is the functionality I'm looking for:

I have a nodetype "parent" and another nodetype "child".
The parent nodetype has a field "amount".
The child nodetype has a nodereference field pointing to a single "parent" node.

When a node of nodetype "parent" is saved, I would like to fire a Rule which does the following:
1. Create "amount" nodes of type "child"
2. Fill the nodereference field in each "child" node with its "parent" node.

The result:

There is one "parent" node.
There are "amount" child nodes and they are all referenced to there "parent" node.

Afterwards there could be another "parent" node, for example "parent node 2".
The amount field in "parent node 2" could be for example "5".
Then there would be 5 "child" nodes created and referenced to "parent node 2"

Does somebody have some tips or a direction where I can look further in to?

Thanks!

Comments

Maybe better with D7 and "Relation"

maxplus's picture

Hi,
I found this great screencast of Johan Falk: http://dev.nodeone.se/en/relation-presentation-at-drupalcity-47-min

So I'm currently looking at the possibility to maybe completely throw away the D6 solution and start all over again with D7 and the powerful Relation module (http://drupal.org/project/relation).

I will keep you informed how it turns out.

Hello Max, Did you find any

rajeevk's picture

Hello Max,

Did you find any solution for this ?

I also have some what same reuirement but for me one field will be changed based on some PHP custom code.

Thanks,

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: