You are here: LANSA for i User Guide > 3. Files > 3.15 Virtual Fields > Mathematical Examples
Mathematical Examples

This screen demonstrates the use of the "Mathematical calculation of a field" option and how it may be used to produce a "virtual" field's value by performing a mathematical calculation.

Calculate the Gross sales price of a transaction by multiplying the Net sales price by the Current sales tax rate and adding the result to the Gross sales price:



 DC@P201607         Mathematical calculation of a field                


 File: SALTRN     Sales Transaction file                               


 Virtual field: GRSPRC     Gross sales price                           


 Derive "virtual" field on input from file . . : YES YES, NO           


   C A L C U L A T I O N    S P E C I F I C A T I O N                  

    Value 1     Operation  Value 2        Result                       

    __________      S      0_________     GRSPRC____                   

    NETPRC____      /      100_______     *WORKNET01                   

    *WORKNET01      *      SALTAX____     *WORKTAX01                   

    NETPRC____      +      *WORKTAX01     GRSPRC____                   

    __________      _      __________     __________  +                



 Fnn=Help  Fnn=Exit  Fnn=Cancel  Fnn=Messages  Fnn=Change  Fnn=Delete