Hi, I am trying to subtract a number from my product_in_stock value, to create a safety margin when exporting quantities.
Let's say my product_in_stock has a value of 30, I want the output to be 25.
I tried setting the default value for this field to -5. But the export result is still 30, so this doesn't work.
When I try a replacement with a regular expression:
input: /(.*)/e
replace with: ('\1')-5
the output is 25-5 (so the subtraction works but -5 gets added as text to the result).
I am not a champion of regular expressions. Anyone know how to get the result I want?
Thanks!
Hello,
You are missing a PHP function in the replace for it to make it a number. You can try this but no guarantees :)
floatval('\1')-5
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Nope, still 30-5 :S
Another try maybe
floatval(('\1')-5)
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Nope, it gives the same result.
But I have applied a second replace string:
find: 0-5|1-5|2-5|3-5|4-5|5-5|6-5|7-5|8-5|9-5
replace: 0|1|2|3|4|5|6|7|8|9
regular text
Now I get the correct output.
Creativity rules :)
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Log in to reply to this topic.