Originally posted this in the Rules issue queue ( http://drupal.org/node/1547160 ) but then saw how few posts from the last 2 weeks had any replies. Scary!
When setting a data value (text) I am unable to include a rule variable (also text) in direct input mode. I was originally trying to do this to build up a large string from fields while looping through a list of nodes. For the sake of understandability I've reduced this to the simplest possible case. The rule export is below and requires Devel module.
Note: I can perform direct assignment of one variable to another using data selection. (Unfortunately that does not satisfy my use case.) It's just direct input mode where I'm failing.
Please can someone tell me whether I should be able to do this and, if so, what I'm doing wrong?
{ "rules_example_text_inclusion" : {
"LABEL" : "Example text inclusion",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "devel" ],
"ON" : [ "node_view" ],
"DO" : [
{ "variable_add" : {
"USING" : { "type" : "text", "value" : "*This is the value of text_variable_1*" },
"PROVIDE" : { "variable_added" : { "text_variable_1" : "Text variable 1" } }
}
},
{ "variable_add" : {
"USING" : {
"type" : "text",
"value" : "*This is the initial value of text variable 2*"
},
"PROVIDE" : { "variable_added" : { "text_variable_2" : "Text variable 2" } }
}
},
{ "data_set" : {
"data" : [ "text-variable-2" ],
"value" : "Overwriting the value of text_variable_2:\r\n[text-variable-1]\r\n[text_variable_1]\r\n"
}
},
{ "devel_debug" : { "value" : [ "text-variable-2" ] } }
]
}
}