3 Replies Latest reply on Oct 27, 2011 2:52 PM by Steve L Walker

    Notification when two object fields do not equal?

    mbrad233

      I have an AP input form.  In the header the user enters the invoice amount in a numeric field named InvoiceAmt.  In the body of the form the user enters a GL code along with an associated amount of distribution for that GL code.  There are multiple lines (10) for the GL and amount inputs.  At the end of the 10 entry lines there is a numeric filed named Total that sums the amounts of the GL distributions.  The InvoiceAmt entered in the header must equal the Total amount.  Is there a way to code some sort of popup dialog box or some kind of notification that will alert the user when the Total field and InvoiceAmt fields do not equal?

        • 1. Re: Notification when two object fields do not equal?
          Steve L Walker Level 5

          The attached form uses a dynamic table enabling the addition and deletion of rows. As you add rows and insert column values it validates the table total against the GL Account Total. If the two don't match the table total cell is filled with red.

           

          Untitled.png

          When a cell is corrected and the GL Account Total matches the table total the table total fill colour is reset.

          Untitled1.png

          The calculate event script on the table total looks like this..

           

          // form1.page1.subform1.table.footer.total::calculate - (JavaScript, client)

           

          var rowCnt = form1.page1.subform1.table._row.count;

          var total_ = 0;

          for (var i=0; i < rowCnt; i++) {

                    total_ = total_ + form1.page1.subform1.resolveNode("table.row[" + i + "].total").rawValue;

          }

           

          this.rawValue = total_;

           

          if (this.rawValue > 0 && form1.page1.subform1.glAccountTotal.rawValue > 0) {

                    if (this.rawValue != form1.page1.subform1.glAccountTotal.rawValue) {

             form1.page1.subform1.resolveNode("table.footer.total.ui.#numericEdit.border.fill.color"). value = "255,0,0";

                    }

                    else {

             form1.page1.subform1.resolveNode("table.footer.total.ui.#numericEdit.border.fill.color"). value = "153,153,153";

                    }

          }

           

          Steve

          • 2. Re: Notification when two object fields do not equal?
            mbrad233 Level 1

            Hi Steve,

             

            I understand what how your form is working, but am having a little trouble with the code as my form is not set up exactly like the example.  Is it possible for me to send you my form so the code can be modified accordingly?