Avatar

Correct answer by
Level 10

Hi,

If you have a field bound to element a1 then you can use the dataNode property to reference the bound value, so dataNode.parent.a2.value will reference the "credit" / "debit" value, so in the calculate event you could have;

if (this.dataNode.parent.a2.value === "credit")
this.rawValue = "+"+this.rawValue;
else
this.rawValue = "-"+this.rawValue;

This might be a problem when you submit the form so an alternative would be to update the display picture and display a "+" or "-" literal, maybe in the docReady event.

if (this.dataNode.parent.a2.value === "credit")
this.format.picture.value = "num{'+'z,zz9.99}";
else
this.format.picture.value = "num{'-'z,zz9.99}";

Good luck

Bruce

View solution in original post