Jump to content

Search the Community

Showing results for tags 'calculate'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Caspio Bridge
    • General Questions
    • Caspio JavaScript Solutions
    • Tables, Views and Relationships
    • Import/Export and DataHub
    • DataPages
    • Deployment
    • Security, Authentications, Roles, SAML
    • Styles and Localizations
    • Parameters
    • API and Integration
    • Calculations and aggregations
    • User JavaScript and CSS Discussions

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start




Website URL






Found 4 results

  1. Hi, I need help with calculating total sum based on values, entered in fields. I have 3 fields on the submission form, where users enter 3 values. I would like to calculate total in the forth field. Also, I want to show the value to the user. E.g when user enters value "5" in the first field, he will see "5" in the field Total then user enters "10" in the second field, he will see "15" in the field Total and finally user enters "7" in the third field, he will see "22" in the field Total And I wand to store value 22 in the table. Thanks!
  2. Hi, I'l looking for a way to calculate a field after 3 fields are entered. The fields are: OP_Length, OP_Width, OP_Height. I put a virtual field on the form, named Virtual2, label Volume Calculated, display only Volume = length * width * height Searching here i came to the following, but cannot get it to work. Is that because the Virtual field is not referenced to with the right parameter: getElementsByClassName('cbFormData')[0]; ? <script type="text/javascript"> // Caspio form elements var length = document.getElementById('InsertRecordOP_Length'); var width = document.getElementById('InsertRecordOP_Width'); var height = document.getElementById('InsertRecordOP_Height'); var volume = document.getElementsByClassName('cbFormData')[0]; var caspioForm = document.getElementById('caspioform'); // Event handler var calculateVolume = function (event) { // TODO: Do something on value change --> volume = length.value * width.value * height.value; } // Run total calculation on input to any of these two fields length.addEventListener('input', calculateVolume); width.addEventListener('input', calculateVolume); height.addEventListener('input', calculateVolume); </script>
  3. Hi there,I had this simulator created https://c3esh258.caspio.com/dp.asp?AppKey=d5ad4000296a67c788fa46879a87 and the field "Idade 1º titular" reads an Excel cell that have number values of age from 18 to 80.How can I make "Data de Nascimento 1º titular" do the same thing - reading the age value from that Excel cell - but instead of inputing the age itself, doing so by inputing the date of birth?I would really appreciate any help.Regards,Rui Farinha
  4. This old post from Caspio should be updated with the following changes so that it works when Grouping is enabled: http://forums.caspio.com/index.php/topic/3171-js-calculate-column-sum-in-the-result-page/ Aggregation should be used instead, but if you want to SUM a Calculated Field which in turn is based on a sub-query, it will not be available for Aggregation. See the second paragraph here for details on this case http://howto.caspio.com/release-notes/caspio-bridge-9-0/9-0-known-issues/ I've highlighted the changes below </div> <script> function NumberFormatted(amount,decimal) { if(isNaN(amount)) i = 0.00; else { var v_number = parseFloat(amount); var v_minus = ''; if(v_number < 0) v_minus = '-'; v_number = Math.abs(v_number); v_number = Math.round(v_number*Math.pow(10,decimal)); v_number = v_number/Math.pow(10,decimal); v_numStr = new String(v_number); v_decStr = new String(Math.pow(10,decimal)); if(v_numStr.indexOf(".") < 0) v_numStr = v_numStr + "." + v_decStr.substr(1,v_decStr.length); else v_numStr = v_numStr + v_decStr.substr(1,v_decStr.length); return (v_minus + v_numStr.substr(0,v_numStr.indexOf(".") + decimal + 1)); } } function f_calTotal() { var v_totalRev = 0; var v_rev = 0; var cas_form = document.getElementById("cb_resultTotal"); if (cas_form.getElementsByTagName("table").length > 0) { //For counting all rows, so that we can use the count as the index for inserting a new row. var countRows = cas_form.getElementsByTagName("table")[2].getElementsByTagName("tr"); //For reading just the data rows, not the Grouping rows, to avoid null values. var cas_rows = cas_form.getElementsByTagName("table")[2].querySelectorAll('tr[data-cb-name=data]'); for(var rowIndex=1; rowIndex < cas_rows.length; rowIndex++) { //Narrows down to just data cells. var cells = cas_rows[rowIndex].querySelectorAll(".cbResultSetData"); /* 1 – change value inside brackets to choose column to calculate sum */ v_rev = cells[3].innerHTML; if ( v_rev != " " && !isNaN(v_rev.substr(1))) v_totalRev = v_totalRev + parseFloat(v_rev); } //New row will be based on count of all rows, not count of rows searched. var v_nrow = countRows.length; cas_form.getElementsByTagName("table")[2].insertRow(v_nrow); var o_lastRow = cas_form.getElementsByTagName("table")[2].rows[v_nrow]; o_lastRow.style.background = "#385C7E"; o_lastRow.insertCell(0); o_lastRow.insertCell(1); /* 2 – Display the “Total†label (2 lines below) */ var v_colText = o_lastRow.insertCell(2); v_colText.innerHTML = "<div style='padding:5px;color:#ffffff;font-size:14px;font-weight:bold;font-family:Arial'>Total</div>"; var v_colValue = o_lastRow.insertCell(3); /* 3 – Display the result of the calculation (2 lines below) */ v_colValue.innerHTML = "<div style='padding:5px;color:#ffffff;font-size:14px;font-weight:bold;;font-family:Arial'>$" + NumberFormatted(v_totalRev,2) + "</div>"; o_lastRow.insertCell(4); } } </script> <script> f_calTotal(); </script>
  • Create New...