Help with code:
So imagine I have a customer quote table and a lookup table for reference values, things the customer selects, there are a lot so relationships would fail here as I need to connect to several columns, please don't ask why I'm not using relationships, I need something similar to an excel vlookup or a SQL update query.
At the moment I press the button and nothing happens.
This is the basic request : https://xxxxxxxx.quickbase.com/db/bn2igarv2?act=API_DoQuery&query={6.EX.%27BBLRBWA4SS4001%27}&am... and XML reply.
<qdbapi>
<action>API_DoQuery</action>
<errcode>0</errcode>
<errtext>No error</errtext>
<dbinfo>
<name>Process Costs</name>
<desc>Holds information for Daily Mailing Process Costs</desc>
</dbinfo>
<variables>
<__iol>&rand='+new Date().getTime())};"></__iol>
<iol>
<img qbu='module' src='/i/clear2x2.gif' onload="javascript:if(typeof QBU=='undefined'){QBU={};$.getScript(gReqAppDBID+'?a=dbpage&pagename=
</iol>
</variables>
<chdbids> </chdbids>
<record>
<peritem>0.35</peritem>
<update_id>1537874531635</update_id>
</record>
</qdbapi>
I'm trying to recover the value in the <peritem> tag and put this in the customer quote field _fid_59.
I'm getting closer, I have a button set up in an "-" field and have gone through checks to see if the iol is loading correctly, I followed the instructions here :
The Button at the moment has this formula:
[iol] & "update.js" & [/iol]
&
"<a class='QBU_Button Vibrant Success' " &
"data-rid='" & [Record ID#] & "'" &"
>Update Quote [Name Field]</a>"
---------------------------------------
Page Name: update.js
function(){
$("img[qbu=module]").remove();
$("a.QBU_Button").css({"margin-top": 10});
$("a.QBU_Button").parent("td").css({"border-top": 0});
var dbid = "xxxxxxxx";
var dbidRecords = "bn2h9ha3c"; // the table I'm on
var dbidReference = "bn2igarv2"; // the table i'm trying to get data from
var apptoken = "apptokengoeshere";
$.ajaxSetup({data: {apptoken: apptoken}});
$("a.QBU_Button").on("click", function(event) {
var rid = this.dataset.rid;
var keyword = _fid_24.value; //for the moment I'm using the hardcoded query below which returns '0.35'
$.get(dbidReference, {
act: "API_DoQuery",
query: '{6.EX.'BBLRBWA4SS4001'}',
clist: "9",
}).then(function(xml) {
$("peritem", xml).each(function() {
_fid_59.value += '$("peritem", this).text();' // not sure what this line is doing
})
});
});
Any thoughts on where I'm going wrong?
Question
Java code for DoQuery and return value from another table to populate field
This topic has been closed for replies.
Sign up
Already have an account? Login
Login to the community
Login with Quickbase US – quickbase.com Login with Quickbase EU – quickbase.eu
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.