I am storing a value in a DB (called generalparameter).
This value is a calculation which I call in the JS code.
The issue is the value is a string but I want it to be a calculation value.
e.g. My DB value is:-
(((this.amount / new_rate) - this.stock_payment).toFixed(2) / (this.amount / new_rate) * 100).toFixed(2)
My code is:-
application.getGeneralParameter('UI','CAL_NEW_MARGIN');
But this yields:-
"(((this.amount / new_rate) - this.stock_payment).toFixed(2) / (this.amount / new_rate) * 100).toFixed(2)"
How do I get rid of the ""?
Thanks.
Ian.
evalwill help youeval()function, it's unsafe. And it is not good practice to store code like this in database, it's better if you store in db a flag or a identifier that calls the string in the code. It's only a recommendation. Good luck