• Content count

  • Joined

  • Last visited

  • Days Won

  1. I have the following script for onchange... I would like run it onload also, is there a easy way to do it? <SCRIPT LANGUAGE="JavaScript"> function calculate() { var current = parseFloat(document.getElementById("cbParamVirtual1").value); if (isNaN(current)) current = 0; var installed ='[@calcfield:2]'; var total_hrs ='[@calcfield:1]'; var currenttotal = parseFloat((current - installed) + parseFloat(total_hrs)); document.getElementById("cbParamVirtual2").value =Math.max(0, currenttotal); } document.getElementById("details").onchange=calculate; </SCRIPT> Thanks in advance!
  2. I figured it out thanks to this by @mayMusic Thanks @MayMusic
  3. I'm trying to calculate the number of hrs on a report details page. Its simply (hrs_removed - hrs_installed) nothing fancy. Here is the code I'm trying to use in the footer of my report details page. <SCRIPT LANGUAGE="JavaScript"> function calculate() { var v_field1 = parseFloat(document.getElementById ("EditRecordhrs_removed").value); if (isNaN(v_field1)) v_field1 = 0; var v_field2 = parseFloat(document.getElementById ("EditRecordhrs_installed").value); if (isNaN(v_field2)) v_field2 = 0; var v_total = (v_field1 - v_field2); document.getElementById("EditRecordhrs_total").value = (v_total); } document.getElementById("caspioform").onchange=calculate; </SCRIPT> Trying to get it populate the hrs_total field after putting in the hrs_removed and hrs_installed and before submitting the form.
  4. I currently have a calculated field on a details report that sums up the a total hrs field in a table. This is the current formula and it works perfect... select sum(hrs_total) from tire_hrs_table where tire_id=target.[@field:tire_id] My problem is the hrs_total is the sum of [hrs_removed] - [hrs_installed] of only completed transactions and not currently open transactions. Every record has a hrs_installed but open transactions do not have a hrs_removed yet. I would like to add a virtual field for [current_hrs] to my details report which would allow the user to input the current hours. Then I need to take the virtual field [current_hrs] and subtract [hrs_installed] from records that do not have [hrs_removed] yet to figure out how many hours are on the open transaction currently and then add that to my formula i already have working. Not sure if I would use a CASE statement or how to use it. Hopefully that kinda makes sense. thanks for any help you guys can give
  5. Thanks for the information. Caspio support figured it out, I have multiple datapages with update buttons on a single webpage. Causing the hover over the update button not to work since it was below the first update button. Thanks again!
  6. Sorry for the delay, I tried this and still having the same problem. Thank you
  7. I have the following code to automatically check a yes/no if there is a value in a field. It works when I preview it in Caspio but when it's deployed to my Weebly site and live its not working. Any ideas?
  8. Thank you guys for your help, I've tried both and just can't seem to get it to work. Maybe because this report is receiving parameters that's why I'm struggling? I might have to just hope the users can follow directions and check the box themselves.
  9. Thanks for the information, I can't seem to get it to work still. Should I type out the field names and leave the ( ) or should I use the drop down list to select the field and type of field which adds the [ ] Thanks again
  10. Is there a way to automatically check a yes/no box if another field has data in it? For example I have a yes/no if a shift is complete I would like it switched to yes once the end hrs has data. I need to be able to do this in a report though if possible because of the way I have it set up. I'm thinking it will be javascript but not sure how to do it. Thanks
  11. Tire Hrs Calculation

    Thanks for the response! I'm still struggling on how to make sure the installation/removal is tied together correctly because one tire can go be switched between multiple machines and different positions (left front, right front, etc)
  12. Hello, I'm trying to figure out a way to calculate the total hrs on a tire used on heavy equipment based on the equipment hours. When a tire is put on a piece of equipment the user will put a record for "installed" and input the equipment hours then when the tire is removed the equipment hours will be inputted again. The tire can be installed and removed multiple times throughout its life. I would like a way to calculate the hrs based on the oldest install date (first equipment hour input for that certain tire) and the latest install/removal date. example .... The tire(tire_id) is installed on 1/1/17(date) with 1000 equipment hrs on the equipment, its removed again at 1500 hrs on 2/1/17, its then installed on another equipment on 4/1/17 with 4000 hrs on the new equipment then removed again on 5/1/17 with 4200 hrs on the equipment. So the tire actually has 700 hrs on it between the two equipment's it was placed on and removed from. I think I will have to figure out a way to calculate the difference in hrs based on (removal hrs - installed hrs) and put that amount in a table tied to the tire then do another entry for the second equipment(removal hrs-installed hrs). Then have a way to add up all these entries to figure out total hrs on tire.