我愿意接受如何解决以下问题的建议:
如何迭代所有节点,找到具有相同键的节点,合并多值字段的值,然后删除重复项?
如何创建临时内容,相同的字段,以保存新的统一节点?什么是解决这个问题最简单的方法?
Multivalue field (checkboxes)
A
B
C
etc
内容:
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
预期结果,将多值文本字段合并为一个节点: 可以在临时节点创建期间生成NID。
NID, Title, Other fields, Multivalue field (checkboxes checked)
x, title1, others1, "A, B, C"
x, title2, others2, A
答案 0 :(得分:1)
我终于找到了如何删除重复项,同时使用Feed导入数据,以及使用规则来合并多值字段。以下视频对于获得最终解决方案非常有用:
解决方案(根据客户需求):
节点处理器的设置
导入器使用相同的密钥更新节点,消除重复并使用相同的信息合并记录。
在更新节点后执行规则,以将值添加到多值字段。
**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