Copy link to clipboard
Copied
I'm getting missing before statement, Do I need to separate +* and how do I do it?
event.value = Number(this.getField("field").valueAsString)"+"+*6+"%";
Copy link to clipboard
Copied
What are you trying to achieve, exactly?
Copy link to clipboard
Copied
Sry for late reply. I want value to show like this '+6%' but can't add + sign infront of *6 calculation.
Copy link to clipboard
Copied
Want you display '+6%' or want add 6% of the value?
Copy link to clipboard
Copied
I want it to display '+6%'
Copy link to clipboard
Copied
Use this:
event.value = this.getField("field").valueAsString + "+6%";
Copy link to clipboard
Copied
field uses value from another field so it need to be *6+ "%" I just need + sign to appear in front of result,it should look something like this "+"+ *6+ "%" but it says missing before statement.
Copy link to clipboard
Copied
You wrote:
> I want it to display '+6%'
That's what my code does. I don't understand what you're asking for now.
Bottom line is that everything that you want to add to the value of the field as text needs to be in double-quotes, preceded by a + sign. If you want to include double quotes (or a back-slash) in the string, they have to be preceded by a back-slash.
Copy link to clipboard
Copied
Number is not static it's calculated from another field, I just used 6 as example, sry I should have mention that.
Anyway I managed to get it work with var x like this "+" + x*6+ "%". But would like to know if it's possible without var?
Copy link to clipboard
Copied
What is the value in x?