Reputation: 11
I'm open to suggestions as how to fix the following:
How can I iterate through all the nodes, find the nodes with the same key, consolidate the values of the multivalue field, then delete the duplicates?
what about creating a temp content, same fields, to save the newly consolidated node? what is the easiest way to solve this problem?
Multivalue field (checkboxes)
A
B
C
etc
Content:
Key, NID, Title, Other fields, Multivalue field
key1, 1, title1, others1, A
key1, 2, title1, others1, B
key2, 3, title2, others2, A
key1, 4, title1, others1, C
expected results, consolidate the multivalue text field to have a single node: NID can be generated during the temp node creation.
NID, Title, Other fields, Multivalue field (checkboxes checked)
x, title1, others1, "A, B, C"
x, title2, others2, A
Upvotes: 0
Views: 594
Reputation: 11
I finally figured out how to remove duplicates, while importing data with feeds, and using rules to consolidate the multi-value field. The following video was very useful to get to the final solution:
Solution (based on custom needs):
Settings for Node processor
Importer updated the nodes with the same key, eliminating duplicates and consolidating records with the same information.
A Rule was executed, after updating a node, to add values to the multi-value field.
**Events**
After updating existing content of type Course
Before saving content of type Course
**Conditions**
Data comparison
Selected data: node:field-temp
value: equals
the value to compare
**Actions**
Fetch entity by id
Value: taxonomy term
value: term id of the term you want to add to the multivalue field
Variable label: term name here
Variable name: custom_var_name
Add an item to a list
Selected list: node:field-multivaluefield
Data selector: custom_var_name
Enforce uniqueness: True.
Save entity
node:field-multivaluefield:0
Upvotes: 1