4GL Calculate Fields

SOLVED

I am trying to do a simple calculation where I need to multiply two fields and the total is displayed in another field. I believe this can be easily done through 4GL programming, but have some questions. My thinking is I would add an action to the screen/field I want to display the result. 

  • What "Action" type would work best if I want this to run on save of the transaction? 
  • Would something like this work for the script  [M:YITMS]YCSETIR * [M:YITMS]YCSETIRPAL

Any help or examples would be appreciated. 

Thanks!

Parents
  • +1
    verified answer

    Hello,

    action is "APRES_MODIF" in the specific traitment

    Subprog AM_YCSETIR(VALEUR)
    Variable Char    VALEUR()
      Raz [M]YCSETOTAL
      If VALEUR and [M]YCSETIRPAL <> 0
        [M]YCSETOTAL = VALEUR * [M]YCSETIRPAL
      Endif
      Affzo [M]ZCSETOTAL
    End
    
    Subprog AM_YCSETIRPAL(VALEUR)
    Variable Char    VALEUR()
      Raz [M]YCSETOTAL
      If VALEUR and [M]YCSETIR <> 0
        [M]YCSETOTAL = VALEUR * [M]YCSETIR
      Endif
      Affzo [M]ZCSETOTAL
    End

    Hope this can helps you.

Reply
  • +1
    verified answer

    Hello,

    action is "APRES_MODIF" in the specific traitment

    Subprog AM_YCSETIR(VALEUR)
    Variable Char    VALEUR()
      Raz [M]YCSETOTAL
      If VALEUR and [M]YCSETIRPAL <> 0
        [M]YCSETOTAL = VALEUR * [M]YCSETIRPAL
      Endif
      Affzo [M]ZCSETOTAL
    End
    
    Subprog AM_YCSETIRPAL(VALEUR)
    Variable Char    VALEUR()
      Raz [M]YCSETOTAL
      If VALEUR and [M]YCSETIR <> 0
        [M]YCSETOTAL = VALEUR * [M]YCSETIR
      Endif
      Affzo [M]ZCSETOTAL
    End

    Hope this can helps you.

Children