Forum Post: Need to modify script to avoid API call

  • Thread starter Thread starter RichardWalsh
  • Start date Start date
Status
Not open for further replies.
R

RichardWalsh

Guest
I have the following script in a Rollbase page. It selects a VAT rate based on a VAT code in the page and calculates the VAT Amount. However we get a message about exceeding API calls (limit being 1000) after just a dozen or so calculations. In order to get round this for now I want to just hard-code the VAT Rate (20%) in the script and not perform any API calls - which I am assuming is the "Select vat_rate etc..." So I think I want vatDec to be assigned a value of 20. However whatever modifications I try I cannot get it to work. I would be grateful for pointers as to what modification would work. Thanks. Richard. function computePrice() { var goods = rbf_getFieldValue("goods"); var taxCode = rbf_getFieldValue("vat_cd"); rbf_selectValue("SELECT vat_rate FROM vat_rate WHERE vat_code='"+taxCode+"'", function(vatDec) { var vatAmt = parseFloat(goods.substring(1)) * (parseFloat(vatDec) / 100); var total = parseFloat(goods.substring(1)) + vatAmt; rbf_setFieldValue("vat", vatAmt); rbf_setFieldValue("price", total); $("input#vat, input#price").blur(); }); }

Continue reading...
 
Status
Not open for further replies.
Back
Top