Announcement

Collapse
No announcement yet.

Calculated Fileds

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calculated Fileds

    Hi Everyone!

    I need some assistance... I am new to scriptcase and have been playing around.

    Can someone help me on creating calculated fields. I need to create fields like stock on hand, etc...

    Example, you have a transaction table and need to do calculations to get the stock on hand of a specific stock item.

    Thank You

  • #2
    Re: Calculated Fileds

    Is this is a grid for a form?

    Either case, create a 'New Field' in the list of fields. This is a calculated field (user defined)

    You can then populate it as needed.

    In a grid, onRecord event:
    {calc_ext_price} = {qty} * {price};

    In a form, use the same code in onLoad.

    If you need to get the values from another table, then use sc_lookup in onInit to get the value and then populate the calc_field

    pseudo:
    $sql = 'SELECT ...';
    sc_lookup(tbl_lookup,$sql);
    {calc_value} = tbl_lookup[0][0];

    Use onInit to get values before form fields are populated. Use onLoad if you need to access existing form field values.

    Regards,
    Scott.

    Comment


    • #3
      Re: Calculated Fileds

      Hallo Scott!

      Thank You for explaining to me. I will try it out.

      Regards
      Jacques

      Comment

      Working...
      X