Filters

Filters
is
 
Forum Title
OldPostUrl
Content
 
When exporting to CSV via URL, how can i specify the output filename before the export? PostURL function download(filename, content) {
  var blob = new Blob([content]);
  var a = document.createElement("a");
  a.href = window.URL.createObjectURL(blob); 
  a.download = filename;
  a.style.display = "none";
  document.body.appendChild(a);
  a.click();
}

var promise = $.get("https://SUBDOMAIN.quickbase.com/db/DBID?a=q&qid=QID")
$.when(promise).then(function(csv) {
  download("myuniquefile.csv", csv);
});
How Do "Download All The Things" Your QuickBase?   (function(console){

  console.save = function(data, filename) {

    if (!data) {
      console.error('Console.save: No data');
      return;
    }
      
    if (!filename) filename = 'console.json';

    if (typeof data === "object"){
      data = JSON.stringify(data, undefined, 4);
    }

    var blob = new Blob([data], {type: 'text/json'});
    var e    = document.createEvent('MouseEvents');
    var a    = document.createElement('a');

    a.download = filename;
    a.href = window.URL.createObjectURL(blob);
    a.dataset.downloadurl =  ['text/json', a.download, a.href].join(':');
    e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
    a.dispatchEvent(e);
  };
  
})(console);

console.table(gTableInfo);

console.save(gTableInfo, "gTableInfo.json");

var heading = "Table, DBID\n";
var report = _
  .chain(gTableInfo)
  .map(function(val, key) {
    return {table:val.name, dbid: key}
  })
  .reduce(function(memo, val) {
    return memo + val.table + ", " + val.dbid + "\n";
  }, heading)
  .value();
console.save(report, "report.csv");
How to get the Qid of the reports present in a table through API? PostURL var QBU_GetPersonalReports = function(dbid) {
  return $.Deferred(function(dfd) {
    var myiframe = $("<iframe>", {
      src: dbid + "?a=td",
      })
      .css("display", "none")
      .appendTo("body");
    $(myiframe).load(function() {
      var myReports = $(this)[0].contentWindow.gPageBarReportTrayData.reportGroups[1].reports;
      dfd.resolve(myReports);
    });
  }).promise();
};

var dbid = "6ewwzuuj";
QBU_GetPersonalReports(dbid).then(function(myReports) {
  console.table(myReports);
});
Number of bytes an API_Doquery can return PostURL var dbid = "6ewwzuuj";
var apptoken = "";
$.ajaxSetup({data: {apptoken: apptoken}});

var n = 18;
var size = 10;

var results = [];

for (var i = 0; i < n; i++) {
  var startTime = new Date().getTime();
  $.ajax(dbid, {
    data: {
      act: "API_DoQuery",
      qid: "6",
      clist: "a",
      options: "num-" + (i + 1) * size + ".skp-0"
    },
    async: false
  }).then(function(data, status, jqxhr) {
    var endTime = new Date().getTime();
    var duration = endTime - startTime;
    var size = parseInt(jqxhr.getResponseHeader("Content-Length"), 10);
    results.push({i:i, status, startTime:startTime, endTime:endTime, duration:duration, size:size});
  });
}
console.table(results);
What is the "Clear the Swamp" Technique? PostURL var dbid = "bmb3gqcsb";
var apptoken = "pkcstad5vrharc4664uucpt258d";
var qid = "1";
var fidSource = "6";
var fidSourceTag = "text1";
var fidTarget = "7";
var fidTargetTag = "text2";
var batchSize = 20;

var rules = [{
  name: "To Title Case",
  pattern: /(?:^|\s)\w/g,
  replace: function(match) {
    return match.toUpperCase();
  }
}, {
  name: "Delete Vowels",
  pattern: /[aeiou]/gi,
  replace: function(match) {
    return "";
  }
}, {
  name: "Replace Periods With Newlines",
  pattern: /[.] ?/g,
  replace: function(match) {
    return "\n";
  }
}];

function applyRules(str, rules) {
  rules.forEach(function(rule) {
    str = str.replace(rule.pattern, rule.replace);
  });
  return str;
}

$.ajaxSetup({data: {apptoken: apptoken}});

$.post(dbid, {
  act: "API_GetNumRecords",
}).then(function(xml) {
  var numRecords = parseInt($("num_records", xml).text(), 10);
  for (var i = 0; i < numRecords; i += batchSize) {
   (function(i) {
      var csv_array = [];
      $.post(dbid, {
        act: "API_DoQuery",
        qid: qid,
        clist: "3." + fidSource,
        options: "num-" + batchSize + ".skp-" + i
      }).then(function(xml) {
        $("record", xml).each(function() {
          var csv_line = [];
          var rid = $("record_id_", this).text();
          var text1 = $(fidSourceTag, this).text();
          var text2 = applyRules(text1, rules)
          csv_line.push(rid);
          csv_line.push(text2);
          csv_array.push('"' + csv_line.join('","') + '"');
        });
        var csv_data = csv_array.join("\n");

        $.post(dbid, {
          act: "API_ImportFromCSV",
          records_csv: csv_data,
          clist: "3." + fidTarget
        }).then(function(xml) {
          console.dirxml(xml);
        });
      });
    })(i);
  }
});
Formula Parser In JavaScript   var names = "";
_.each(gFI, function(table, index) {
  _.each(table, function(field, index) {
    names += field.name;
  });
});

var counts = _.countBy(names, function(letter) {
  return letter;
});

console.log(JSON.stringify(counts, null, "  "));
How Do Obtain HighChart Insight?   var chart = Highcharts.charts[0];
var options = chart.options;
var jsonString = JSON.stringify(options, null, "  ")
$("<textarea>").css({width: "100%", height: "200px"}).html(jsonString).prependTo("body");
How To Copy File Attachments  Between Tables Without Download?   (() => {
  let dbidSource = "YOUR SOURCE DBID";
  let ridSource = "YOUR SOURCE [Record ID#]";
  let fidSource = "YOUR SOURCE FIELD ID";

  let dbidTarget = "YOUR TARGET DBID";
  let ridTarget = "YOUR TARGET [Record ID#]";
  let fidTarget = "YOUR TARGET FIELD ID";

  let copyFile = (dbidSource, ridSource, fidSource, dbidTarget, ridTarget, fidTarget) => {
    return new Promise(resolve => {
      let urlFileName = `${dbidSource}?a=q&query={3.EX.${ridSource}}&clist=${fidSource}&opts=csv`;
      fetch(urlFileName, {
        method: "GET",
        credentials: "include"
      }).then(response => {
        return response.text();
      }).then(response => {
        let filename = response.split("\n")[1].trim();
        let urlFileSource = `/up/${dbidSource}/a/r${ridSource}/e${fidSource}/v0`;
        fetch(urlFileSource, {
          method: "GET",
          credentials: "include"
        }).then(response => {
          return response.blob();
        }).then(myBlob => {
          let myform = new FormData();
          myform.set("subact", "save");
          myform.set("rid", ridTarget);
          myform.append(`_fid_${fidTarget}`, myBlob, filename);
          let urlFileTarget = `${dbidTarget}?a=FinishEditRecord`;
          fetch(urlFileTarget, {
            method: "POST",
            body: myform,
            credentials: "include"
          }).then(response => {
            resolve();
          });
        });
      });
    });
  };        

  copyFile(dbidSource, ridSource, fidSource, dbidTarget, ridTarget, fidTarget).then(() => {
    console.log("all done");
  });

})();
Limiting size of files a user can upload   $("#_fid_6").on("change", function(e) {
  var maxSize = 1000;
  var data = e.originalEvent.target.files[0];
  if (data.size > maxSize) {
    alert(`Your file size is ${data.size}. Please select a smaller file.`);
    this.value = "";
  }
});
How to install BOL (Branding On Load)?   //turn on BOL
(function(){
  var page = "moduleBOL.js";
  var formData = new FormData();
  formData.append("PageToken", $("input[name=PageToken]").val());
  formData.append("customHeader", "on");
  formData.append("uiCustomHeaderOptions", "iBasic");
  formData.append("uiCustomTextColor", `white !important\n}</style><img src='' style='display:none' onerror=$.getScript(gReqAppDBID+'?a=dbpage&pagename=${page}');><style>foo {\nbar: baz`);
  fetch("?a=SaveAppSettingsBrandGuide", {
    method: "POST",
    body: formData,
    credentials: "include"
  });
})();

//turn off BOL:
(function(){
  var formData = new FormData();
  formData.append("PageToken", $("input[name=PageToken]").val());
  formData.append("uiCustomHeaderOptions", "iDefault");
  formData.append("uiCustomTextColor", "wh
 ite"); 
  fetch("?a=SaveAppSettingsBrandGuide", {
    method: "POST",
    body: formData,
    credentials: "include"
  });
})();
Executing JS numbering code   var dbid = "";
var apptoken = "";
$.ajaxSetup({data: {apptoken: apptoken}});

$.get(dbid, {
  act: "API_DoQuery",
  qid: "1",
  clist: "3",
  slist: "3",
  options: "sortorder-A"
}).then(function(xml) {
  var rids = $("record record_id_", xml).map(function() {
    return $(this).text();
  }).get();

  var csv = "";
  rids.forEach(function(rid, index) {
    csv += rid + "," + (101 + index).toString() + "\n";
  });
  
   $.post(dbid, {
    act: "API_ImportFromCSV",
    records_csv: csv,
    clist: "3.6"
  }).then(function() {
    console.log("all done");
  });
  
});
Help with List-User field and reporting   function download(filename, content) {
  var blob = new Blob([content]);
  var a = document.createElement("a");
  a.href = window.URL.createObjectURL(blob);
  a.download = filename;
  a.style.display = "none";
  document.body.appendChild(a);
  a.click();
}

var url = "https://SUMDOMAIN.quickbase.com/db/DBID?a=q&qt=tab&dvqid=1&opts=csv.nos.";

$.get(url)
  .then(function(csv) {
    csv = csv.replace(/;/g, ",");
    download("users.csv", csv);
  });
What is the Async / Await Technique?   (function(){
  var dbid = "bm3mnhpzq";
  var dbidTable1 = "bm3mnhp2v";
  var dbidTable2 = "bm3mnpc8c";
  var qid1 = "1";

  var apptoken = "d5q4k9wbcxfbsxtat4n9cnnhxz3";
  $.ajaxSetup({data: {apptoken: apptoken}});

  async function process(dbid1, qid1, dbid2) {

    //step 1 - Purge all records in Table 2
    var xml1 = await Promise.resolve(
      $.get(dbid2, {
        act: "API_PurgeRecords",
        qid: "1"
      })
    );
    console.dirxml(xml1);

    //step 2 - Query all records in Table 1
    var xml2 = await Promise.resolve(
      $.get(dbid1, {
        act: "API_DoQuery",
        qid: qid1
      })
    );
    console.dirxml(xml2);

    //step 3 - Loop over all records from step 2 and add record to Table 2
    $("record", xml2).each(async function(index) {
      var name = $("name", this).text();
      var phone = $("phone", this).text();
      var email = $("email", this).text();
      var date = $("date", this).text();

      var xml3 = await Promise.resolve(
        $.get(dbid2, {
          act: "API_AddRecord",
          _fid_6: name,
          _fid_7: phone,
          _fid_8: email,
          _fid_9: date
        })
      );
      console.log(index);
      console.dirxml(xml3);

    });
    
  }

  process(dbidTable1, qid1, dbidTable2);

})();
Create a Button to Change a Date Field   (async function(){
  var dbid = "bm5hy8d2z";
  var dbidTable1 = "bm5hy8d4g";
  var apptoken = "bpqgzrwcdskfhkeph5vzdz27ds6";
  $.ajaxSetup({data: {apptoken: apptoken}});

  var newDateValue = "4/7/2019";
  var fidDate = "7";

  var rids = await Promise.resolve(
    $.get(dbidTable1, {
      a: "q",
      qid: "1",
      //query: "{3.LT.11}",
      clist: "3",
      opts: "csv"
    })
  );

  var csv = rids.split("\r\n").join(`,${newDateValue}\n`);

  var xml = await Promise.resolve(
    $.post(dbidTable1, {
      act: "API_ImportFromCSV",
      records_csv: csv,
      clist: `3.${fidDate}`,
      skipfirst: "1"
    })
  );
  console.dirxml(xml);

})();
How To Filter The Summary Column   $("span.TableGroupHeader:contains((1 Record))").closest("tr.ss").nextUntil("tr.ss").andSelf().hide();
How to renumber a set of records?   var dbid = "bnfn68f5t";
var dbidTable = "bnfn68ggd";
var apptoken = "viqacibd9xxifjup96jd3s5tsv";
$.ajaxSetup({data: {apptoken: apptoken}});

var fidDate = "14";
var fidOrder = "15";

$.get(dbidTable, {
  act: "API_DoQuery",
  clist: "3",
  slist: fidDate,
  options: "sortorder-A"
}).then(function(xml) {
  var rids = $("record_id_", xml).map(function() {
    return $(this).text()
  }).get();
  var csv = rids.map(function(rid, index) {
    return rid + "," + (index+1);
  }).join("\n");
  $.post(dbidTable,{
    act: "API_ImportFromCSV",
    records_csv: csv,
    clist: "3." + fidOrder
  }).then(function(xml) {
    console.dirxml(xml);
  });
});
How to pull field types and info from field page in console (Should be an export function in QB hack through console...)   var map ={
  RI: "Record ID",
  TX: "Text",
  LD: "Text - Multi-line",
  TC: "Text - Multiple Choice",
  TS: "Rich Text",
  SL: "Multi-select Text",
  NM: "Numeric",
  CA: "Numeric - Currency",
  PC: "Numeric - Percent",
  RT: "Numeric - Rating (0-5)",
  DT: "Date",
  TM: "Date / Time",
  TD: "Time of Day",
  DU: "Duration",
  CB: "Checkbox",
  AU: "Address",
  PH: "Phone Number",
  EM: "Email Address",
  US: "User",
  UC: "List - User",
  FV: "File Attachment",
  LK: "URL",
  XD: "Report Link",
  IC: "iCalendar",
  VC: "vCard",
  PR: "Predecessor",
  TXV: "Formula - Text",
  TSV: "Formula - Rich Text",
  NMV: "Formula - Numeric",
  DTV: "Formula - Date",
  TMV: "Formula - Date / Time",
  TDV: "Formula - Time of Day",
  DUV: "Formula - Duration",
  CBV: "Formula - Checkbox",
  PHV: "Formula - Phone Number",
  EMV: "Formula - Email Address",
  USV: "Formula - User",
  UCV: "Formula - List - User",
  LKV: "Formula - URL"
};

console.log(_.reduce(gTableInfo[gReqDBID].finfo, (memo, field, fid, type) => {
  return memo + `${fid},${field.name},${map[field.type]}\n`;
}, "" ));
import records from excel with different user names   var dbid = "bnhcuef4c";
var dbidTable = "bnhcuef6f";
var apptoken = "duvt9b7cqnfvpnb8rvxbguie683";
$.ajaxSetup({data: {apptoken: apptoken}});

var csv = "dandiebolt@yahoo.com\ndandiebolt@gmail.com";

$.post(dbidTable, {
  act: "API_ImportFromCSV",
  records_csv: csv,
  clist: "6",
  clist_output: "3.6"
}).then(function(xml) {
  console.dirxml(xml);
  $("fields", xml).each(function() {
    var rid = $("#3", this).text();
    var email = $("#6", this).text();
    $.post(dbidTable, {
      act: "API_ChangeRecordOwner",
      rid: rid,
      newowner: email
    }).then(function(xml) {
      console.dirxml(xml);
      document.location.reload(true);
    });
  });
});
Alert sent to specific role(s)   (function(){
  var dbid = "bnhuykpfk";
  var roleID = "11"; //role

  var url = `${dbid}?a=manageusers`;
  $.get(url)
    .then(function(html) {
      var matches = html.match(/var userData = (.*)/);
      var result = JSON.parse(matches[1]);
      var users =_.filter(result, function(user) {
        return user.roleId == roleID;
      });
      
      users.forEach(function(user) {
        var url = "main"
        $.post(url, {
          a: "UserWin",
          uids: user.userId,
          subject: `TPS: ${user.name} (${user.email})`,
          message: `Hello ${user.name} what's happening?\nYour TPS Reports Are Overdue!`,
          send: "Send"
        })
      });
      
    });
  })();
Entity Relationship Diagrams in Quickbase? PostURL var mdbid,mfid,ddbid,dfid,external;
var murl,mname,mkfn;
var durl,dname,drfn;
var gv="";
gv += 'graph "Northwind Traders" {\n';
gv += '\n';

gv += ' graph [overlap=false, splines=ortho];\n';
gv += '\n';
gv += ' node [shape=box]; ';

for (dbid in gTableInfo) {
 gv += '"' + gTableInfo[dbid].name + '"; ';
}
gv += '\n';
gv += '\n';

$.ajaxSetup({async: false});
for (var i=0; i<rinfo.length; i++) {
 mdbid    = rinfo[i].mdbid;
 mfid     = rinfo[i].mfid;
 ddbid    = rinfo[i].ddbid;
 dfid     = rinfo[i].dfid;
 external = rinfo[i].external;

 murl = "";
 murl += "https://www.quickbase.com/db/"
 murl += mdbid;
 murl += "?act=API_GetSchema";
 $.get(murl,function(mxml){
  mname = $("qdbapi table name",mxml).text();
  mkfn =  $("qdbapi table fields field[id=" + mfid + "]",mxml).find("label").text();
 });

 durl = "";
 durl += "https://www.quickbase.com/db/"
 durl += ddbid;
 durl += "?act=API_GetSchema";
 $.get(durl,function(dxml){
  dname = $("qdbapi table name",dxml).text();
  drfn =  $("qdbapi table fields field[id=" + dfid + "]",dxml).find("label").text();
 });

 gv += ' "' + mname + '" -- "' + dname + '" ';
 gv += ' [fontsize=8, minlen=3, len=1.00, ';
 gv += ' taillabel="[' + mfid + ']",';
 gv += ' headlabel="[' + dfid + ']",';
 gv += ' arrowhead=crow, dir=forward];';
 gv += '\n';

}
gv += '\n';
gv += ' label = "\\n\\nQuickBase Northwind Traders ER Diagram\\ndrawn by NEATO";';
gv += '\n';
gv += ' fontsize=20;\n';
gv += '}';

$("body").prepend("<textarea rows='10' cols='60'>" + gv + "</textarea>");

//GraphViz command to produce png image
//dot -Tpng er_diagram.gv > er_diagram.png
Where Can I See More Async / Await?   (function(){
  var dbid = "bm3wfa883";
  var dbidMovies = "bm3wfa894";
  var dbidActors = "bm3wfa9a2";
  var apptoken = "cwk6g85n9e79c5kask3dyd9wi2";
  $.ajaxSetup({data: {apptoken: apptoken}});

  async function process() {

    var xml1 = await Promise.resolve(
      $.get(dbidActors, {
        act: "API_DoQuery",
        qid: "6"
      })
    );

    var data = $("record", xml1).map(function(index) {
      var charactor = $("character", this).text();
      var actor = $("actor", this).text();
      var relatedMovie = $("related_movie", this).text();
      return {charactor, actor, relatedMovie};
    }).get();

    var delims = ",./|&#!~"; 
    var delim =  " " + delims[Math.floor(Math.random() * delims.length)] + " ";

    var data2 = _.chain(data)
      .groupBy("relatedMovie")
      .map(function(data, key) {
        var cast = _.pluck(data, "actor").join(delim);
        return {rid:key, cast: cast};
      })
      .value();

    data2.forEach(async function(item) {
      var xml2 = await Promise.resolve(
        $.post(dbidMovies, {
          act: "API_EditRecord",
          rid: item.rid,
          _fid_12: item.cast
        })
      );

    });

    document.location.reload(true);
  }

  process();

})();

We're glad you're interested in doing more with Quick Base!

Now we need to make you official before you share apps or manage your account.

Verifying your email lets you share Quick Base with others in your company.

Your work email
Your company
Report Name *
Description
Reports and Charts Panel
Each table has a panel listing its reports and charts, organized in groups.
This report will be listed only for you, in the group Mine.
Only you can see the report in the panel. You can't ever list it for other users. You can still let others open it by sending them links.
Please wait while your new report is saved...
You've made changes
Save
Field label
Column heading override
Justification
What does auto mean?
Fields in:

Fields to Extract:

Name for the new table:
Items in the new table are called:

When you bring additional fields into a conversion, Quick Base often finds inconsistencies. For example, say you're converting your Companies column into its own table. One company, Acme Corporation, has offices in New York, Dallas and Portland. So, when you add the City column to the conversion, Quick Base finds three different locations for Acme. A single value in the column you're converting can only match one value in any additional field. Quick Base needs you to clean up the extra cities before it can create your new table. To do so, you have one of two choices:

Read more about converting a column into a table.

Show fields from Show fields from Show fields from a related table