• In some cases, we may read a lookup table (10 rows) to determine a value based on a code.

    This is your problem.

    Replace those functions with views and join your tables to them.

    _____________
    Code for TallyGenerator