1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

calculate in list

Discussion in 'Community' started by gatticlaudio, Oct 21, 2019.

  1. gatticlaudio

    gatticlaudio Claudio

    Level: Community
    Hi, how can I do that in the "Balance" column, I have the updated value on each line.
    Let it be calculated automatically ....
    The list is generated from a mysql view
    Thank you.

  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    Calc elements are calculating on the fly (if you didn't change the default "only calculate on save" from no to yes).
    So use a calc element.
    Or define your mysql view column as the balance you want to show.
  3. gatticlaudio

    gatticlaudio Claudio

    Level: Community
    Hi Troester, I thought of a calculated field, but as I refer to the field in the list and it is a partial accumulated, it is not just the difference between 2 columns ...

    return ((int) '{Cajaingresoegreso ___ cashed}' - (int) '{Cajaingresoegreso___pagado}');

    That calculation did not work.

    Thank you.
  4. Nagtegaal

    Nagtegaal Member

    Level: Community
    I go with the suggestion of Troester that you add the saldo in your MYSQL view. The SQL would be something like this:

    SELECT fecha, description, sum(sum(pagado-cobrado)) OVER (ORDER BY fecha, description) as saldo
    FROM your_table
    GROUP BY fecha, description
    ORDER BY fecha, description

Share This Page