Is there a way to display the positive (plus) sign when a calculation result is positive?
Solved! Go to Solution.
Views
Replies
Total Likes
Ok. After playing around for a bit I figured it out. I ended up with this script. It will change the numerical field background color based on a positive, negative or neutral value and it will also display the positive/negative sign. With your help radzmar I was able to finish this. Thanks.
var num1 = (xfa.resolveNode("form1.#subform.CurrentWeight[9]").rawValue) - (xfa.resolveNode("form1.#subform.PrevWeight[9]").rawValue)
if (num1 > 0)
{
this.fillColor = "252,194,194";
this.format.picture = "num{'+'zz9.zz} 'lbs.'";
}
else if (num1 < 0)
{
this.fillColor = "194,252,194";
this.format.picture = "num{zz9.zz} 'lbs.'";
}
else if (num1 == 0)
{
this.fillColor = "194,194,252";
}
this.rawValue = num1;
Views
Replies
Total Likes
I don't think this is possible through Patterns. However, you can change it through scripting.
Note that you can't do it on a Numeric Field. It should be a Text Field instead.
nith
Views
Replies
Total Likes
You can use a script in the change event to switch between display patterns.
Views
Replies
Total Likes
This didn't work for me. I tried switching it to a text field and it still didn't work. I'm wondering if it has anything to do with the values being calculated instead of user inputting data. Oh well. Not a huge deal, just curious.
Views
Replies
Total Likes
Sorry, missed the fact it's calculated.
Try this in the calculate event.
Views
Replies
Total Likes
Yes. It does the plus and I added the minus sign but it doesn't show the calculate value!! Just shows zero with a minus or positive symbol depending on value.
Views
Replies
Total Likes
Ok,
try it this way:
Ok. After playing around for a bit I figured it out. I ended up with this script. It will change the numerical field background color based on a positive, negative or neutral value and it will also display the positive/negative sign. With your help radzmar I was able to finish this. Thanks.
var num1 = (xfa.resolveNode("form1.#subform.CurrentWeight[9]").rawValue) - (xfa.resolveNode("form1.#subform.PrevWeight[9]").rawValue)
if (num1 > 0)
{
this.fillColor = "252,194,194";
this.format.picture = "num{'+'zz9.zz} 'lbs.'";
}
else if (num1 < 0)
{
this.fillColor = "194,252,194";
this.format.picture = "num{zz9.zz} 'lbs.'";
}
else if (num1 == 0)
{
this.fillColor = "194,194,252";
}
this.rawValue = num1;
Views
Replies
Total Likes