Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Rules -> Action -> Calculate a value does not receive the value of the field field-number.
Events
After saving new content
Conditions
Content is of type
Parameter: Content: [node], Content types: Number
Actions
Calculate a value
Parameter: Input value 1: [node:field-number], Input value 2: 1
Provides variables: Calculation result (result)
Set a data value
Parameter: Data: [node:field-number], Value: [result]
Reports -> Recent log messages
Warning: The variable or parameter input_1 is empty.
Comments
Comment #1
Yuri CreditAttribution: Yuri commentedI had the same error message, and the reason was that the input value was not zero, but empty: the field did not yet have a value.
Apparently Rules does not handle empty values the same as zero in calculations.
Comment #2
TR CreditAttribution: TR commentedThis was answered long ago by #1.
So you can either configure your field to have a default value, or you can add a condition to your Rule to check that field-number has a value before you use it.
Comment #3
TR CreditAttribution: TR commented