Jump to content
  • 0

Update Field Using Conditions


ccocker

Question

Hi guys,

 

I am new to Caspio looking to migrate an application I built in MS Access.  So I am used to writing VBA procedures and functions.

 

I am trying to work out how to update one field based on multiple criteria based on user input.

 

For example I have an Issues form with three fields Probability, Severity and Rating.  Rating I would like to be updated automatically based on the input of the Probability and Severity Field.  i.e. Low Probability and Medium Severity would result in a Rating of Low, where as High Probability and High Severity would result in a Rating of Critical.

 

I would like the field Rating to be physically updated in the table so whenever I write reports or extract the data I have the Rating field.

 

I cannot see anyway to do it on a Form and I have tried looking at reports with calculated fields etc. But alas I am lost.

 

Is there an easy way to do this or is this something I need to look at customising with Java Script.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

It is not a standard feature but should be possible by JS. What is the DataPage type? Submission or update? Are Probability and Severity Field text fields? Or they are dropdown?

 

You need to have something like:

<script>
function rate(){

if (document.getElementById('Probability ID').value == 'Low' && document.getElementById('SeverityID').value == 'Medium'){
document.getElementById('RATE').value = 'Low';
} else if (document.getElementById('Probability ID').value == 'High' && document.getElementById('SeverityID').value == 'High'){}
document.getElementById('RATE').value = 'Critical';
}
document.getElementById('caspioform').onsubmit=rate;
</script>

You need to replace IDs with actual IDs and also add more condition as required.

Link to comment
Share on other sites

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.

Guest
Answer this question...

×   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.

Loading...
×
×
  • Create New...