Jump to content

Compare Two Fields And Show Result From Another Field If Matched

Recommended Posts

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.



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);




Link to comment
Share on other sites

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:




WHEN [@calcfield:2] = [@field:Grade] THEN [@field:Week_Pay]







The field "Grade" has these records:








The field "Week_Pay" has these records that correspond to Grade








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.



Link to comment
Share on other sites

  • 2 weeks later...

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...