7 Replies Latest reply on Mar 8, 2008 2:01 PM by Günter Schenk

    Add Transaction Field error

      I'm working on a multi-page form and am having trouble with an add transaction field (it's page 3, so it's an update transaction behavior).

      There are about a dozen checkboxes each with a numerical value. Three of the fields have a "qty" text field associated with them. All are set as numeric both in the form and the mysql database.

      I used the Add Transaction Field to add the various checkbox transaction values together. But they only seem to evaluate to 1 or nothing, not to the checkbox values that I need to add and multiply together.

      How do I get the add transaction to work for this scenario?

      {fee_horse}+
      ...lots more txn fields...
      {fee_rider_rec_tix_qty})+{stall_basic}+
      ({stall_addl_night}*{stall_addl_night_qty})+
      ({stall_shavings}*{stall_shavings_qty})

      and the error I'm getting:

      tNG_fields.evaluateFieldExpr:
      Could not evaluate expression: '1+++1++(1*6)++(*)+(*)'. (FIELDS_EVAL_EXPR_FAILED)

      These numbers should be more like this: 350+25+0+25+0+(20*6)+0+(0*25)+(2*7)

      Anybody know how to get those values into an add transaction using checkboxes? Should I use text input fields instead?
        • 1. Re: Add Transaction Field error
          Level 1
          Getting closer. I went back after creating this page with the "Update form wizard" and edited the "update transaction" in the behaviors panel and realized I had the checkboxes set to submit as "checkbox 1,0". I changed that and now the numbers are coming through in the equation instead of just 1's.

          Now the problem I have is how do I get the checkbox field to submit a "0" when the value is null or empty?
          • 2. Re: Add Transaction Field error
            Günter Schenk Level 4
            Hi Beth,

            when those checkbox values have initially been defined to submit a Y,N or 1,0 or -1,0 value (e.g. CHECKBOX_YN_TYPE),I *think* that ADDT will be using those ones within a Custom Transaction and not a custom checkbox value like 25.

            Not sure if I´m completely right though ;-)

            Can you upload the page code as text file and provide a link to that ?

            Cheers,
            Günter Schenk
            Adobe Community Expert, Dreamweaver
            • 3. Re: Add Transaction Field error
              Level 1
              OK, not so pretty, but I just added a "0" before each transaction name. Is there a better way? It appears to work but...

              0{fee_horse}+
              ...lots more txn fields...
              0{fee_rider_rec_tix_qty})+
              0{stall_basic}+
              (0{stall_addl_night}*0{stall_addl_night_qty})+
              (0{stall_shavings}*0{stall_shavings_qty})
              • 4. Re: Add Transaction Field error
                Level 1
                Here's the text file! Thanks Gunter.

                http://www.sharoncamarillo.com/classics/western/entry/step_03.txt
                • 5. Re: Add Transaction Field error
                  Günter Schenk Level 4
                  Hi Beth,

                  thanks for the link -- well, usually I would have suggested to rather use some native PHP if-else preprocessing, something like...

                  if($tNG->getColumnValue("column_name") == '' || $tNG->getColumnValue("column_name") == '0') {
                  $value = '0';
                  }
                  else {
                  $value = $tNG->getColumnValue("column_name");
                  }

                  ...but as you´re using an EXPRESSION here, I doubt such custom preprocessing would be allowed in here, so your "not so pretty" solutions seems an appropriate way to to that.

                  Cheers,
                  Günter Schenk
                  Adobe Community Expert, Dreamweaver
                  • 6. Re: Add Transaction Field error
                    Level 1
                    Well, it's adding things up all funny, so I think I'll start over. I should add a table with just the costs. It'll probably be easier to update that way anyhow. Calculations might be easier too.

                    So the custom trigger I should be looking for is something like:
                    if this checkbox is checked, add the associated field's value to the subtotal.
                    • 7. Re: Add Transaction Field error
                      Günter Schenk Level 4
                      you should also consider to perform a calculation "on the fly" on a page which needs it, rather than submitting the calculation value to the database

                      Cheers,
                      Günter Schenk
                      Adobe Community Expert, Dreamweaver