Calculated Field on Catalog Item

alexcharleswort
Tera Expert

So, I know how to do this pretty easily on a custom table, but I am looking to do this on a catalog item. I have the variables tra_tuition0, tra_tuition1, and tra_tuition3. On change of these, I want them to automatically fill out tra_tuition_total with the sum of those three numbers?

Thanks in advance for your help!

6 REPLIES 6

Hi Alex,


An easy way would be to create separate client scripts for setting the value of the empty fields to zero:



function onChange(control, oldValue, newValue, isLoading) {


      if (newValue == '') {  


      g_form.setValue('tra_tuition1', '0') ;


      }


}



This will automatically change the field to zero if the number gets deleted


Regards,


ALI


So another question. This is the method I am using and I made a few scripts, one for each different field but it seems to be calculating funny. Looks like when I fill in two of them it calculates just fine, but when I add a third (and it doesn't matter in which order I fill out the variables) it gives me a decimal... any idea what might be wrong or what 'number' before the variable actually does? (ignore the highlighting)


find_real_file.png