Currently I have a rules as follows:

{ "rules_update_mitarbeiterzahl_von_firma" : {
"LABEL" : "Update Mitarbeiterzahl von Firma",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "Contacts" ],
"REQUIRES" : [ "rules", "rules_conditional" ],
"ON" : { "node_update--contact" : { "bundle" : "contact" } },
"IF" : [
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_firmen" } },
{ "NOT data_is_empty" : { "data" : [ "node:field-firmen" ] } }
],
"DO" : [
{ "LOOP" : {
"USING" : { "list" : [ "node:field-firmen" ] },
"ITEM" : { "firma_der_person" : "Firma der Person" },
"DO" : [
{ "CONDITIONAL" : [
{
"IF" : { "entity_has_field" : { "entity" : [ "firma-der-person" ], "field" : "field_mitarbeiterzahl" } },
"DO" : [
{ "variable_add" : {
"USING" : {
"type" : "integer",
"value" : [ "firma-der-person:field-mitarbeiterzahl" ]
},
"PROVIDE" : { "variable_added" : { "aktuelle_mitarbeiteranzahl" : "Aktuelle Mitarbeiteranzahl" } }
}
},
{ "data_calc" : {
"USING" : {
"input_1" : [ "aktuelle-mitarbeiteranzahl" ],
"op" : "+",
"input_2" : "1"
},
"PROVIDE" : { "result" : { "neue_ma_anzahl" : "Neue Mitarbeiter Anzahl" } }
}
},
{ "drupal_message" : { "message" : "TEST [neue-ma-anzahl:value]" } }
]
}
]
}
]
}
}
]
}
}

Also see the image attached.
No matter wether I calculate a value or just set want to show the value of neue-ma-anzahl in a message with a token, this token will always be empty. Outside if a if condition this works in rules. May this be a bug in this awesome module?

CommentFileSizeAuthor
#1 rule-conditional.png22.5 KBmanuelBS
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

manuelBS’s picture

FileSize
22.5 KB
Yuri’s picture

I confirm this bug, and have a similar use case.

Yuri’s picture

Priority: Normal » Major
nanabrownee’s picture

Has anyone found a way around this?

Yuri’s picture

"Set data value" also not working inside a conditional section.

Yuri’s picture

Still nobody responding, while this quite an important issue.

oturpin’s picture

Hi all,

Same issue with Rules 2.9. I have defined and calculated a rules variable. But, cannot use it in af "if" statement.
Is this a bug ? or a normal limitation ?

Thx