To create calculated fileds

is it possible use calculated workflows on 6-7 dropdowns and get the final output in a field ?

Yes absolutely. There are many ways.

  1. You can do it via JavaScript and add it to the editview
  2. You can do it via PHP and do an on save hook.
  3. You can do workflow and calculate it. Option 1, and 2 work after save. Only option 1 is live on the screen.

For the JS method, it’s a bit complicated. The basic process is to include the JS file in a custom viewdefs. You can also include the JS with a custom application hook as an alternate method.

Here 's an example of JS that I use to calculate billable time x rate = total billing…

// Custom JavaScript code
$(document).ready(function() {
    // Function to update total_billing based on bill_rate and hours
    function updateTotalBilling() {
        var billRate = parseFloat($('input[name="bill_rate"]').val());
        var hours = parseFloat($('#hours').val());

        if (!isNaN(billRate) && !isNaN(hours)) {
            var totalBilling = billRate * hours;
            $('#total_billing').text(totalBilling.toFixed(2));
        }
    }

    // Attach event listeners to bill_rate and hours fields
    $('input[name="bill_rate"], #hours').on('input', updateTotalBilling);

    // Initialize total_billing field
    updateTotalBilling();
});
1 Like