Good morning folks
I understand how if %asset_metadata_MyNumber% is 10 then;
%asset_metadata_MyNumber^subtract:4% would return 6
However, how do I calculate;
100 - %asset_metadata_MyNumber% to return 90
Thanks in advance
Good morning folks
I understand how if %asset_metadata_MyNumber% is 10 then;
%asset_metadata_MyNumber^subtract:4% would return 6
However, how do I calculate;
100 - %asset_metadata_MyNumber% to return 90
Thanks in advance
You can’t mix standard keywords and hard-coded integers like that. The server has no idea what ‘100’ is, or that it needs to calculate anything.
(If 100 was the resulting value of another metadata keyword, you could do what you want, however, using the subtract modifier.)
You need to use SSJS for this use case.
Would just doing reverse the calculation and getting the absolute value work for your use case?
%asset_metadata_MyNumber^subtract:100^abs%
Hi Folks
Thank you for your responses - they helped me decide my course of action;
What I ended up doing was setting an uneditable meta-data to a number (asset_metadata_set-num = 100) and used the following;
%asset_metadata_set-num^subtract:{asset_metadata_MyNumber}%
This works fab