Copy link to clipboard
Copied
Hello, I apolgize if this isn't the write place to request this, but was hoping could get help with a custom calculation script. I see similar calculation script posts but not too good with code to change to this specficiation.
I would like to set the field to "Number" format category (no decimals, just initally), but when they enter the number it calculates this way:
Thank you for any help in advance
In that case you can't use the Number format. Check it to Custom and as the custom Format script enter the following:
if (event.value) event.value = event.value/10000;
Copy link to clipboard
Copied
Do you want to actually change the value they enter, or just display it in this way?
Copy link to clipboard
Copied
The value can remain the same, I just want it to be displayed as the decimal/calculation.
Copy link to clipboard
Copied
In that case you can't use the Number format. Check it to Custom and as the custom Format script enter the following:
if (event.value) event.value = event.value/10000;
Copy link to clipboard
Copied
This is great, thank you very much. Is there anyway to include in the code an option to restict the value to number format?
Either way this is very helpful and works as intended.
Thank you again for your time and help!
Copy link to clipboard
Copied
You would need to use a custom keystroke or validation script for that.
For the latter you can use something simple, like this:
if (isNaN(Number(event.value))) {
event.rc = false;
app.alert("You must enter a number.");
}