How sum these fields in Customer table.

markyTmarkyT Member Posts: 120
Hello, I've created a new field on Customer table called Terms (code). I'd like to know how can I sum de "Payment Terms Code" field and "Payment Days Code" field and show the result on Terms field.
In "Payment Terms Code" field the days appears like 20D and on "Payment Days code" it appears like 20 (without D or S, etc..).
Thanks in advance.

Comments

  • matttraxmatttrax Member Posts: 2,309
    So you want to add a code field to an integer field, then store it as a code field. Well you can't add them directly, so that means you'll have to convert the code field to an integer. Take a look at the DELCHR and EVALUATE functions for that.

    Then you want to add them together and store the value in your new field. You'll need to add code to the correct triggers so that every time one of the two values changes your new field gets updated. Then of course back fill all of the data.
  • markyTmarkyT Member Posts: 120
    Thanks, I'll try it. Thanks for help.
  • FDickschatFDickschat Member Posts: 380
    I'm not sure what you are trying to achieve:

    "Payment terms code" is a code which relates to a table. The record in the table contains a date formula (next to other things). One customer has 1 payment term.

    "Payment days" is a table where you can store 1 to many days on which the customer pays (ES version). The field "Payment Day" is an integer field.

    The "Payment Days Code" field on the customer card contains the customer no. (same principle as invoice discount used) and is a code field.

    So you are trying to "sum" exactly what and for what purpose?
    Frank Dickschat
    FD Consulting
Sign In or Register to comment.