Closed (won't fix)
Project:
Rules
Version:
7.x-2.1
Component:
Rules Core
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
25 Jul 2012 at 15:35 UTC
Updated:
4 Feb 2019 at 23:52 UTC
Jump to comment: Most recent
Comments
Comment #1
mitchell commented> If Im not missing something, the Calculate a Value option has only 4 basic functions available.
That's accurate. There isn't any php.module integration with this action for something like a PHP operator.
> ...to be able to make some advanced calculations here.
Could you please be more specific? Perhaps we might be able include these calculations in a generic, reusable fashion.
Comment #2
hgurol commentedHard to be specific. A rounding function would be great. I was thinking more about mixing text with calculated values.
I have two weight fields both for US units (ounce, pound) and for European units (gram, kilogram) where the user provides one of them, not both. Im trying to calculate the not provided weight field and then print both of them like "34 oz / 963 gr". Im working on this for more than a week now and still couldnt manage to do it. Data type conversions, rounding up numbers etc etc, too many problems I have faced.
I thought to be able to use some custom php on the Calculate Value action would solve all of my problems.
Comment #3
zhangtaihao commentedPlease ignore. Wrong issue.
Comment #4
zhangtaihao commentedRestored status.
Comment #5
hgurol commented@mitchell
Did you have time to think about a workaround ?
Comment #6
tr commentedmin/max have been added in the years since this was first opened.
If you would like to see additional functions, please open a new issue with a specific proposal. Preferably with a patch+test.
There has been no community interest in adding this feature for almost 7 years now. At this late point in the D7 development cycle there aren't going to be many new features added - those should go into the D8 version of Rules. And in any case, we're simply not going to add the ability to use PHP code here - that's just too dangerous and unnecessary. The best thing to do if you have a specific need to manipulate data in a certain way is to write your own action - then you can do exactly what you want. If you do this, then you can post your action in this queue as a feature request which may be put into Rules if there is community interest.