Answered
negative dollar amount format
A client would like negative dollar amounts in her form to be displayed with parentheses, minus sign, and dollar sign (e.g., "(-$12.34)"), in addition to being red. How do I do that?
A client would like negative dollar amounts in her form to be displayed with parentheses, minus sign, and dollar sign (e.g., "(-$12.34)"), in addition to being red. How do I do that?
Try this code:
if (event.value) {
if (Number(event.value)<0) {
event.target.textColor = color.red;
event.value = "(" + util.printf("%,0.2f", event.value).replace("-", "-$") + ")";
} else {
event.value = "$" + util.printf("%,0.2f", event.value);
event.target.textColor = color.black;
}
}Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.