Forum Discussion
_anomDiebolt_
12 years agoQrew Elite
This code when used in conjunction with the image onload technique will do what you want:
var dbid = "your dbid here";var apptoken = "your apptoken here";
$.ajaxSetup({data: {apptoken: apptoken}});
var promise = $.get(dbid,{ act: "API_DoQuery", clist: "3", slist: "3", options: "num-1.sortorder-D"});
$.when(promise).then(function(xml){ var next_rid = $("record_id_",xml).text() + 1; $("#_fid_8").val($("#_fid_7").val() + "-" + next_rid));});
All I am doing here is performing an AJAX query for the largest [Record ID#] in the table and adding one to it and prefixing it with the [Department Number] value which presumably has been selected and is in the field with fid=7. The calculated inventory number is then pushed into the field with fid=8. Minor modifications might be needed to get this to run in your application using the workflow you require.
Don't screw around with other solutions that modify the problem you need solved. This technique (IOL + script) will solve all QuickBase problems you can formulate.
var dbid = "your dbid here";var apptoken = "your apptoken here";
$.ajaxSetup({data: {apptoken: apptoken}});
var promise = $.get(dbid,{ act: "API_DoQuery", clist: "3", slist: "3", options: "num-1.sortorder-D"});
$.when(promise).then(function(xml){ var next_rid = $("record_id_",xml).text() + 1; $("#_fid_8").val($("#_fid_7").val() + "-" + next_rid));});
All I am doing here is performing an AJAX query for the largest [Record ID#] in the table and adding one to it and prefixing it with the [Department Number] value which presumably has been selected and is in the field with fid=7. The calculated inventory number is then pushed into the field with fid=8. Minor modifications might be needed to get this to run in your application using the workflow you require.
Don't screw around with other solutions that modify the problem you need solved. This technique (IOL + script) will solve all QuickBase problems you can formulate.