Page 1 of 1

Plus and Minus operator errors in Row_Rendering server event

Posted: Thu Jan 05, 2023 1:41 am
by aspsteve

I need help in including the plus and minus operators in row rendering.

Please see my below which is throwing an error

// Row Rendered event
public void Row_Rendered() {
    //VarDump(<FieldName>); // View field properties
ShortPayment.EditCustomAttributes = "readonly=\"readonly\"";
InvoiceTotal.EditCustomAttributes = "readonly=\"readonly\"";
InvoiceTotal.EditValue = "ExtendedAmount + TaxAmount";
ShortPayment.EditValue = "InvoiceTotal - PaymentAmount";
}

InvoiceTotal, ShortPayment, ExtendedAmount, TaxAmount are all existing fields in the table


Re: Plus and Minus operator errors in row rendering.

Posted: Thu Jan 05, 2023 7:05 am
by MichaelG

You should convert the field value to the correct value type first before adding/subtracting. For example:

InvoiceTotal.EditValue = ConvertToDouble(ExtendedAmount.CurrentValue) + ConvertToDouble(TaxAmount.CurrentValue);
ShortPayment.EditValue = ConvertToDouble(InvoiceTotal.CurrentValue) - ConvertToDouble(PaymentAmount.CurrentValue);