Elena Posted November 16, 2015 Report Share Posted November 16, 2015 Hello there, Can you please assist once more? I have fields in a view table, they are from two different tables. I would like to compare values from a field in Table 1, and a field from Table2. Then if they are equal, my desire is to show a specific value that would come from a field in Table 2. The script that I put together doesn't work, please help and take a look when you get the chance. All assistance is really appreciated, thank you for the attention. Below is my script. <SCRIPT LANGUAGE="JavaScript"> function compare(){ var schedule = parseFloat(document.getElementById("Grade").value); var actual = parseFloat(document.getElementByName(“[@calcfield:2]").value); var rangemin = if (schedule == actual){ match = parseFloat(document.getElementById("Week_Pay").value); document.getElementById("InsertRecordRangeMin").value = Math.round(rangemin); } document.getElementById("caspioform").onsubmit=compare; }</script> Quote Link to comment Share on other sites More sharing options...
Jan Posted November 16, 2015 Report Share Posted November 16, 2015 Hello Elena, Maybe, you can use a standard feature: to perform calculations in DataPage based on a conditional or IF, THEN, ELSE statement using Calculated Fields. I hope, it helps. Quote Link to comment Share on other sites More sharing options...
Elena Posted November 16, 2015 Author Report Share Posted November 16, 2015 Hi Jan, Thank you for the quick turnaroud.I did try the standard SQL statements that Caspio supports, that didn't work for my purpose. The problem is, the data in the field "Grade" from which the result should show is not getting selected right. This is was what I had: CASE WHEN [@calcfield:2] = [@field:Grade] THEN [@field:Week_Pay] ELSE 0 END The field "Grade" has these records: 110 120 130 140 150 The field "Week_Pay" has these records that correspond to Grade $28000 $32000 $50980 $55900 $58200 The calculated field yields the same numbers as the records in the field "Grade" which are (110, 120, 130, 140, 150) So if the calculated field yields 110, then the field "RangeMin" should show $28000 that it should get from the field "Week_Pay". The SQL statements above is not selecting the right number (record) from "Week_Pay". Thank you for the help. Elena Quote Link to comment Share on other sites More sharing options...
Jan Posted November 27, 2015 Report Share Posted November 27, 2015 Hi Elena, I apologize for delay with the answer You can try the following formula: CASE WHEN CAST([@calcfield:2] AS Integer) = CAST([@field:Grade] AS Integer) THEN [@field:Week_Pay] ELSE 0 END Does it work for you? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.