How to create a rule to combine the terms of 2 fields to create a new term stored it in a 3rd field? I have a content type that has 3 term reference fields:


Field A, required, is a term reference using a vocabulary with machine name vocabulary_a.
Field B, required, is a term reference using a vocabulary with machine name vocabulary_b.
Field C, is a term reference using a vocabulary with machine name vocabulary_c and is generated automatically.


When creating or updating a node, values are entered for field A and B. I want to have a rule (using the Rules module) with some Rules Action to set a data value for field C, equal to the concatenation of the value entered for field A and B. Here is a picture of what I'm trying to achieve:



When I use a Rules Action of "Set a data value" (for field C), I can only refer to one value (eg the token from Field A), and not to the tokens from both Fields (A and B).

So how can I get this to work somehow?

Note that this is a followup to these prior questions (which are not duplicates ...):


How to create a rule to combine the terms of 2 fields to create a new term and store it in a 3rd field? : that question assumes the taxonomies for the 3 fields are the same (as per the "The tags from those 3 fields all relate to the same taxonomy." in it). While this question here is about "Each of these 3 fields have their own taxonomy (they are different)".
How to correct my rule to prevent duplicate taxonomy terms to be created? : that question is about preventing the creation of duplicate terms for the "Field C" (when using the rule in the linked question). And inherently (since it is a followup question) also is about the same taxonomy for the 3 fields.


So this question here is about (a) those 3 fields which each have their own taxonomy and (b) at the same time avoiding the duplicate terms to be created.
My previous answer is based on using Rules Event &quot;View a node of content type Article&quot;.
However (as confirmed by OPer after I posted a comment about that, in a comment deleted by a moderator), I think it should be (1) When a node of that content type is created and also (2) When a node of that content type is updated. But (3) when a rules event like &quot;View a node of that content type&quot; happens, I think that should NOT trigger any Rules Action (because viewing should not change any of those values).
Here is a variation of the previous rule, which takes the above into account:
{ &quot;rules_combine_taxonomy_terms_in_a_3rd_taxonomy_for_create_and_up&quot; : {
    &quot;LABEL&quot; : &quot;Combine taxonomy terms in a 3rd taxonomy for create and update&quot;,
    &quot;PLUGIN&quot; : &quot;reaction rule&quot;,
    &quot;OWNER&quot; : &quot;rules&quot;,
    &quot;REQUIRES&quot; : [ &quot;rules&quot;, &quot;rules_conditional&quot; ],
    &quot;ON&quot; : { &quot;node_presave--article&quot; : { &quot;bundle&quot; : &quot;article&quot; } },
    &quot;DO&quot; : [
      { &quot;drupal_message&quot; : { &quot;message&quot; : &quot;Value of term for Field C has to be set to \u003Cstrong\u003E[node:field-a][node:field-b]\u003C\/strong\u003E, i.e. the combination of the value of Field A (= \u003Cstrong\u003E[node:field-a]\u003C\/strong\u003E) and the value of Field B (= \u003Cstrong\u003E[node:field-b]\u003C\/strong\u003E).&quot; } },
      { &quot;variable_add&quot; : {
          &quot;USING&quot; : { &quot;type&quot; : &quot;text&quot;, &quot;value&quot; : &quot;[node:field-a][node:field-b]&quot; },
          &quot;PROVIDE&quot; : { &quot;variable_added&quot; : { &quot;combined_term&quot; : &quot;Combined Term&quot; } }
        }
      },
      { &quot;entity_query&quot; : {
          &quot;USING&quot; : {
            &quot;type&quot; : &quot;taxonomy_term&quot;,
            &quot;property&quot; : &quot;vocabulary&quot;,
            &quot;value&quot; : &quot;vocabulary_c&quot;
          },
          &quot;PROVIDE&quot; : { &quot;entity_fetched&quot; : { &quot;existing_terms&quot; : &quot;Existing Terms&quot; } }
        }
      },
      { &quot;variable_add&quot; : {
          &quot;USING&quot; : { &quot;type&quot; : &quot;boolean&quot;, &quot;value&quot; : &quot;0&quot; },
          &quot;PROVIDE&quot; : { &quot;variable_added&quot; : { &quot;new_term_exist&quot; : &quot;New term exists&quot; } }
        }
      },
      { &quot;LOOP&quot; : {
          &quot;USING&quot; : { &quot;list&quot; : [ &quot;existing-terms&quot; ] },
          &quot;ITEM&quot; : { &quot;current_term&quot; : &quot;Current term&quot; },
          &quot;DO&quot; : [
            { &quot;CONDITIONAL&quot; : [
                {
                  &quot;IF&quot; : { &quot;text_matches&quot; : { &quot;text&quot; : [ &quot;current-term:name&quot; ], &quot;match&quot; : &quot;[combined-term:value]&quot; } },
                  &quot;DO&quot; : [
                    { &quot;data_set&quot; : { &quot;data&quot; : [ &quot;new-term-exist&quot; ], &quot;value&quot; : &quot;1&quot; } },
                    { &quot;data_set&quot; : { &quot;data&quot; : [ &quot;node:field-c&quot; ], &quot;value&quot; : [ &quot;current-term&quot; ] } },
                    { &quot;drupal_message&quot; : { &quot;message&quot; : &quot;Term \u003Cstrong\u003E[node:field-a][node:field-b]\u003C\/strong\u003E already existed and will be used to automatically set the value for Field C to this term also.&quot; } }
                  ]
                }
              ]
            }
          ]
        }
      },
      { &quot;CONDITIONAL&quot; : [
          {
            &quot;IF&quot; : { &quot;data_is&quot; : { &quot;data&quot; : [ &quot;new-term-exist&quot; ], &quot;value&quot; : &quot;0&quot; } },
            &quot;DO&quot; : [
              { &quot;entity_create&quot; : {
                  &quot;USING&quot; : {
                    &quot;type&quot; : &quot;taxonomy_term&quot;,
                    &quot;param_name&quot; : &quot;[combined-term:value]&quot;,
                    &quot;param_vocabulary&quot; : &quot;vocabulary_c&quot;
                  },
                  &quot;PROVIDE&quot; : { &quot;entity_created&quot; : { &quot;term_created&quot; : &quot;Created term&quot; } }
                }
              },
              { &quot;entity_save&quot; : { &quot;data&quot; : [ &quot;term-created&quot; ], &quot;immediate&quot; : &quot;1&quot; } },
              { &quot;data_set&quot; : { &quot;data&quot; : [ &quot;node:field-c&quot; ], &quot;value&quot; : [ &quot;term-created&quot; ] } },
              { &quot;drupal_message&quot; : { &quot;message&quot; : &quot;Term \u003Cstrong\u003E[node:field-a][node:field-b]\u003C\/strong\u003E did not yet exist and was created just now. It will be used to automatically set the value for Field C to this term also.&quot; } }
            ]
          }
        ]
      }
    ]
  }
}

To import it in your own site (using the Rules UI), use the same trick as in my prior answer.
The difference with my previous answer is (a) another Rules Event and (b) the messages that are simplified now.
Probably most important is that there is no more page refresh needed (you see the result right away).
Demo
Some messages that will be shown, depending on the scenario used:

Update an existing node, or create a new node, with a term for field C that already existed:

Value of term for Field C has to be set to Term A6Term B1, i.e. the combination of the value of Field A (= Term A6) and the value of Field B (= Term B1).
Term Term A6Term B1 already existed and will be used to automatically set the value for Field C to this term also.


Update an existing node, or create a new node, with a term for field C that did not yet exist:

Value of term for Field C has to be set to Term A3Term B1, i.e. the combination of the value of Field A (= Term A3) and the value of Field B (= Term B1).
Term Term A3Term B1 did not yet exist and was created just now. It will be used to automatically set the value for Field C to this term also.



Done ...