Copy link to clipboard
Copied
I need a field called Orders to turn Red if the field is empty and if any of the following four fields have a number in the field. CashSubTotal, AMEXSubTotal, Cash Total, AMEX Total. If the Orders field has data in it, the Orders field fillColor should have no color.
I have tried many different If Else statements and can't figure this out.
Thanks for any help.
Copy link to clipboard
Copied
Your description is not very clear. So the field's fill color should be red if that field itself is empty, and all the other fields? In other words, if any of those fields has a value (including that one itself), it should not be red?
Copy link to clipboard
Copied
This is an expense form. If the person has an expense, they fill in the category for the expense. The total of the expenses go into either CashSubtotal or AMEXSubtotal. There is also a final total field of CashTotal and AmexTotal. I do not need these fields colored. When an expense is placed, all costs arer added in the CashSubtotal or AMEXSubtotal field. There are other costs that will populate the CashTotal and AMEXTotal fields. The individual is required to enter an order number for job costing in the ORDERS field. This field is not always filled out and that is the field I want RED if and of the four fields I mentioned above have an entry and the Order field is left blank.
Hope this gives a better explanation.
Copy link to clipboard
Copied
Sorry, I can't follow your last sentence:
> This field is not always filled out and that is the field I want RED if and of the four fields I mentioned above have an entry and the Order field is left blank.
Did you mean to write "if any of the four fields"? That would make a bit more sense...
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You can use this code as the field's custom calculation script, then:
var fields = ["CashSubTotal", "AMEXSubTotal", "Cash Total", "AMEX Total"];
var myFillColor = color.transparent;
for (var i in fields) {
var f = this.getField(fields[i]);
if (f.valueAsString!="") myFillColor = color.red;
}
event.target.fillColor = myFillColor;
Copy link to clipboard
Copied