Jump to content

Search the Community

Showing results for tags 'rounding'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Caspio Bridge
    • Caspio Apps for Ukraine
    • 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 3 results

  1. Hello, I have a number field ('Qty') in a submission form that is for recording the quantity of hours worked. So for example if someone worked 1 hour and 15 minutes the Qty value would be entered as 1.25. A new option I put in the submission form is a Start_Time field and an End_Time field (both Date/Time fields). A button running js puts the current date/time stamp in the Start_Time field and then when the user is done they click a button to put the new current date/time stamp in the End_Time field. The difference between the two are the minutes worked, put in the Qty field via CalculatedField setting: Datediff(minute,[@field:Start_Time],[@field:End_Time])/60.00. This seems to work well so far. What I then need to do is Round Up to the nearest 15 minute value. For example, if the calculation for Start_Time 12/31/2019 11:45 and End_Time 12/31/2019 14:10 returns 2.416666 I need it to round up to 2.5. I've tried various Round() scenarios but can't get it right. Basically, I want the Qty value to always be a version of .25, .5, .75, 1, 1.25, 1.5, 1.75, 2, etc. Does anyone know how to use Round in the calculation above to do that? Many thanks!
  2. I need help with a calculation that needs to round to the tenth of a percent. I have an update form with four fields. The fourth field is a calculation based on the numbers entered into 1, 2, and 3. Management Expenses Fundraising Expenses Total Revenue AFR My calculation must add management + fundraising and divide that sum by Total Revenue. The result should be input into the AFR field and rounded to the tenth of a percent. A few examples of what I need to accomplish: 500 + 500 / 12,000 = 0.0833333 this should be rounded to 8.3% 600 + 500 / 12,500 = 0.088 this should be rounded to 9.0% The current code that I have used based on the first calculation above only shows 8.0%. I'm new to java so I don't know all the coding that I could be missing here. One other wrinkle is that I would like the calculation to strip any symbols. For example if someone enters $1,200 or $1,200.01 I would like to show only 1200 or 1200.01 in the field. I need a way to ensure no symbols are entered into those fields that may render a calculation error. <SCRIPT LANGUAGE="JavaScript"> function calculate() { var v_management = parseFloat(document.getElementById("EditRecordManagemenExpenses").value); var v_fundraising = parseFloat(document.getElementById("EditRecordFundraisingExpenses").value); var v_totalrevenue = parseFloat(document.getElementById("EditRecordTotalRevenue").value); var v_afr = (([v_management + v_fundraising] / v_totalrevenue)*100); document.getElementById("EditRecordAFR").value = Math.round(v_afr).toFixed(1) + "%"; } /* On submitting the webform, the function calculate is executed */ document.getElementById("caspioform").onchange=calculate; </SCRIPT> Any help would be appreciated! One other wrinkle is that I would like the calculation to strip any symbols. For example
  3. I have a datapage that automatically insert numbers from a Caspio table into an html generated table on a Details page. Calculated values are also inserted into the table on the Details page. The problem is that a number such as 43 is incorrectly inserted into the table as 43.00. A number such as 1.23 is correctly inserted into the table as 1.23. What code do I need to insert so that 43 is inserted as 43 and not as 43.00? Numbers such as 1.23 would still need to be inserted as 1.23, and not simply as 1. Thanks, Thor
  • Create New...