- Issue created by @bigtomfelix
- 🇮🇹Italy bigtomfelix
Thanks for the quick response. Would you be so kind as to show me how to use it?
- 🇮🇪Ireland marksmith
1. First install and enable the ECA Tamper (and Tamper) modules.
2. Create the fields, like: field_integer_1, field_integer_2, field_result
3. Set up the ECA as follows.3.1. Add event: choose the
Insert content entity
event type, select entity type and bundle where the fields are located3.2. Add the
Tamper:Math
task to the event, with the following configuration:
Data: [entity:field_integer_1:value]
Token name: result (no square brackets!) / you are free to choose your token name (see under 3.3)
Operation: Addition
Value: [entity:field_integer_2:value]3.3. Add the
Entity:Set field value
task to the previous task with the following configuration:
Method: set and clear previous value
Field name: field_result (no square brackets here!)
Save entity: Yes
Field value: [result] (use the square brackets, refers to the token name assigned under 3.2.) - 🇮🇹Italy bigtomfelix
Thank you very much, you have been very kind. I followed your instructions step by step. It doesn't give me an error but it doesn't produce the value of the sum in the third field (result). I do not understand why....
- Status changed to Fixed
over 1 year ago 6:13am 15 May 2023 - 🇩🇪Germany jurgenhaas Gottmadingen
Very nice, thanks for helping out @marksmith - and I've added this sample to the list for the ECA Guide library.
- 🇮🇹Italy bigtomfelix
Hello, I need some help, always for the same case. If I had to perform the same addition or subtraction action when the content is updated it returns me an error "Recursion within configured ECA events detected. Please adjust your ECA configuration so that it avoids infinite loops. Affected event: update menu....". is it a false positive? or am I doing something wrong?
- 🇮🇪Ireland marksmith
Your initial question was about the creating a new entity event. You mention an update event in your last question, which is a different event. I don't know where the error might come from, perhaps the relation between the two events is not properly configured. Did you configure the two events within the same model? I didn't notice any error messages with my configuration attached below.
- 🇮🇹Italy bigtomfelix
Thanks for the quick response. I really think I followed your instructions. I attach the model.
- 🇩🇪Germany jurgenhaas Gottmadingen
When you start with the
Update entity
event, and then change that entity and save it in that model, that will trigger another update entity event, which your model will then respond to again. Which leads to an infinite loop. ECA is built to take care of that and will prevent this from happening, but triggering an error message, that the model should be corrected, so that this is no longer happening.When your model started with the
Insert entity
event, that wasn't a problem, because later updating it, won't get you into that loop.To prevent this from happening, you may consider using the
pre-save entity
event. This is being called earlier, i.e. before the entity was updated. In that case, you can make your modifications and DO NOT save the entity during that process, because the process which triggered that event will do that already - after your model has been completed.The benefit of the pre-save event is that it is the same for creating new and updating existing entities. So, it is more common, but still not suitable everywhere.
- 🇮🇹Italy bigtomfelix
Perfect, I did as you said and it works without errors.
Thank you, you are great.. Automatically closed - issue fixed for 2 weeks with no activity.