Filters

Filters
is
 
Forum Title
OldPostUrl
Content
 
tabs for quickbase PostURL (function(){
  var querystring=document.location.search;

  if (/dlta=mog/i.test(querystring)) {
    //GRID EDIT PAGE ========================================
    //alert("You are on the Grid Edit Page");

  } else if(/a=er/i.test(querystring)) {
    //EDIT RECORD PAGE ========================================
    //alert("You are on the Edit Record Page");

  } else if (/a=API_GenAddRecordForm/i.test(querystring)) {
    //API_GenAddRecordForm PAGE ========================================
    //alert("You are on the GenAddRecordForm Page!");

  } else if (/GenNewRecord/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    //alert("You are on the Add Record Page");

  } else if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    alert("You are on the Add Record Page");

    var markup = "";
    markup += "<ul>";
    $("#formContents div.sectionDiv").each(function(index){
      markup += "<li><a href='#tab_" + (index+1) + "'>" + $("span.sectionTitle",this).text() + "</a></li>";
    });
    markup += "</ul>";

    $("#formContents").prepend(markup);

    $("#formContents div.sectionDiv").each(function(index){
      $(this).attr("id","tab_" + (index+1));
      $("div:lt(2)",this).hide();
    });

    $("#formContents").tabs();

  } else if(/a=dr/i.test(querystring)) {
    //DISPLAY RECORD PAGE
    //alert("You are on the Display Record Page");
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

  } else if(/a=q/i.test(querystring)) {
    //REPORT PAGE ========================================
    //alert("You are on the Report Listing Page");

  } else if(/a=td/i.test(querystring)) {
    //TABLE DASHBOARD PAGE ========================================
    //alert("You are on the Table Dashboard Page");

  } else {
    //OTHER PAGE ========================================
    //alert("You are on the Some Other Page");
  }

})();
Warning message when resources are assigned to different jobs during the same time period PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    //alert("You are on the Add Record Page");

    var apptoken = "tu4i6qb5458i5cen85gpdvbcqwf";
    var dbid = "biphfciid";

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

    DoSave = (function(fn){  
      return function(){

        var s = $("#_fid_7").val();
        var e = $("#_fid_8").val();

        var promise1 = $.get(dbid,{
          act: "API_DoQuery",
          query: "{8.GT." + s + "}",
          clist: "3"
        });

        var promise2 = $.get(dbid,{
          act: "API_DoQuery",
          query: "{7.LT." + e + "}",
          clist: "3"
        });

        $.when(promise1, promise2).then(function(xhr1, xhr2){

          var xml1 = xhr1[0];
          var xml2 = xhr2[0];

          var rids1 = $("record_id_", xml1).map(function() {return $(this).text()}).get();
          var rids2 = $("record_id_", xml2).map(function() {return $(this).text()}).get();

          var rids = _.intersection(rids1, rids2);

          if (rids.length == 0) {
            alert("No timedate conflict. The form would normally be saved but this would disrupt the data in my demo.");
          } else {
            alert("You have a timedate conflict. The form was not saved.");
          }
        });
      }  
    })(DoSave);  
  }
})();
Use part of a fields data PostURL (function(){
  var querystring=document.location.search;

if (/dlta=mog/i.test(querystring)) {
    //GRID EDIT PAGE ========================================
    alert("You are on the Grid Edit Page");

  } else if(/a=er/i.test(querystring)) {
    //EDIT RECORD PAGE ========================================
    alert("You are on the Edit Record Page");

} else if (/a=API_GenAddRecordForm/i.test(querystring)) {
    //API_GenAddRecordForm PAGE ========================================
    alert("You are on the GenAddRecordForm Page!");

  } else if (/GenNewRecord/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    alert("You are on the Add Record Page");

  } else if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    alert("You are on the Add Record Page");

    $("#_fid_6").on("blur", function(){
      $("#_fid_6").val( $("#_fid_6").val().substring(4,13) );
    });

  } else if(/a=dr/i.test(querystring)) {
    //DISPLAY RECORD PAGE
    alert("You are on the Display Record Page");
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

} else if(/a=q/i.test(querystring)) {
    //REPORT PAGE ========================================
    alert("You are on the Report Listing Page");

  } else if(/a=td/i.test(querystring)) {
    //TABLE DASHBOARD PAGE ========================================
    alert("You are on the Table Dashboard Page");

  } else {
    //OTHER PAGE ========================================
    alert("You are on the Some Other Page");
  }

})();
Is there anyway to reset created table id's back to one? PostURL (function(){
  var querystring=document.location.search;

if (/dlta=mog/i.test(querystring)) {
    //GRID EDIT PAGE ========================================
    alert("You are on the Grid Edit Page");

  } else if(/a=er/i.test(querystring)) {
    //EDIT RECORD PAGE ========================================
    alert("You are on the Edit Record Page");

} else if (/a=API_GenAddRecordForm/i.test(querystring)) {
    //API_GenAddRecordForm PAGE ========================================
    alert("You are on the GenAddRecordForm Page!");

  } else if (/GenNewRecord/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    alert("You are on the Add Record Page");

  } else if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    alert("You are on the Add Record Page");

  } else if(/a=dr/i.test(querystring)) {
    //DISPLAY RECORD PAGE
    alert("You are on the Display Record Page");
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

} else if(/a=q/i.test(querystring)) {
    //REPORT PAGE ========================================
    alert("You are on the Report Listing Page");

  } else if(/a=td/i.test(querystring)) {
    //TABLE DASHBOARD PAGE ========================================
    alert("You are on the Table Dashboard Page");

  } else {
    //OTHER PAGE ========================================
    alert("You are on the Some Other Page");
  }

})();
What Are Client Side Formulas? PostURL (function(){

  var promise1 = $.getScript("biu8jaqyv?a=dbpage&pagename=suncalc.js");
  var promise2 = $.getScript("biu8jaqyv?a=dbpage&pagename=date.js");

  $.when(promise1, promise2).then(function(){

    var myFormula = function(date, lat, lon) {
      times = SunCalc.getTimes(date, lat, lon);

      var sunrise = Date.today().set({
        hour: times.sunrise.getHours(),
        minute: times.sunrise.getMinutes()
      }).toString("h:mm tt");

      var sunset = Date.today().set({
        hour: times.sunset.getHours(),
        minute: times.sunset.getMinutes()
      }).toString("h:mm tt");

      var template = "<b> {{sunrise}} / {{sunset}} </b>";
      var data = {sunrise: sunrise, sunset: sunset};
      var markup = Mustache.render(template, data);

      return markup;
    };

    var querystring=document.location.search;

    if(/a=er/i.test(querystring)) {
      var $sunrisesunset = $("img[onload*='module.js']").parent("td");

      $("#_fid_6, #_fid_7, #_fid_8").on("change keypress paste focus textInput input", function(){

        var mydate = Date.parse($("#_fid_6").val());
        var lat = $("#_fid_7").val();
        var lon = $("#_fid_8").val();

        var markup= myFormula(mydate, lat, lon);

        $sunrisesunset.html(markup);
      }).change();

    }
  });
})();
How do I create dynamic line numbers for the number of related records? PostURL (function(){
  var querystring=document.location.search;

  if(/a=q/i.test(querystring)) {
    //REPORT PAGE ========================================
    //alert("You are on the Report Listing Page");
    $("td.FirstColumn").each(function(index){
      $(this).text(index+1);
    });
  }

})();
Automatic Creation of a Reoccuring Task PostURL (function(){
  var querystring=document.location.search;

  if(/a=er/i.test(querystring)) {
    //EDIT RECORD PAGE ========================================
    //alert("You are on the Edit Record Page");

    var dbid = "biwtzs4i9";
    var apptoken = "b6wnkk2dzdweuxdkrcihtd4m5q7y";

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

    var url1 = "biwtzvt9m?a=dbpage&pagename=date.js";
    var promise1 = $.getScript(url1);

    $.when(promise1).then(function(){
      
      $("#_fid_6").change(function() {
        if (this.checked) {
          var promise2 = $.post(dbid,{
            act: "API_AddRecord",
            _fid_7: $("#_fid_7").val(),
            _fid_8: $("#_fid_8").val(),
            _fid_9: $("#_fid_9").val(),
            _fid_10: $("#_fid_10").val(),
            _fid_11: $("#_fid_11").val(),
            _fid_12: Date.today().toString("dd-MM-yy"),
            _fid_13: Date.today().addDays(14).toString("dd-MM-yy")
          });
          $.when(promise2).then(function(){
            alert("New Record Created - Don't Forget To Save The Current Record!");
          });
        }
      });

    });

  }

})();
Image onload technique not working with new dashboards? PostURL //https://bobfaulk.quickbase.com//db/birarsi4t?a=dbpage&pageID=12&raid=371

(function(){
  var querystring=document.location.search;

  if (/dlta=mog/i.test(querystring)) {
    //GRID EDIT PAGE ========================================
    alert("You are on the Grid Edit Page");

  } else if(/a=er/i.test(querystring)) {
    //EDIT RECORD PAGE ========================================
    alert("You are on the Edit Record Page");

  } else if (/a=API_GenAddRecordForm/i.test(querystring)) {
    //API_GenAddRecordForm PAGE ========================================
    alert("You are on the GenAddRecordForm Page!");

  } else if (/GenNewRecord/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    alert("You are on the Add Record Page");

  } else if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    alert("You are on the Add Record Page");

  } else if(/a=dr/i.test(querystring)) {
    //DISPLAY RECORD PAGE
    alert("You are on the Display Record Page");
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

  } else if(/a=q/i.test(querystring)) {
    //REPORT PAGE ========================================
    alert("You are on the Report Listing Page");

  } else if(/a=td/i.test(querystring)) {
    //TABLE DASHBOARD PAGE ========================================
    alert("You are on the Table Dashboard Page");

  } else {
    //OTHER PAGE ========================================
    alert("You are on the Some Other Page");
  }

})();
Generic module.js User Defined Page   (function(){
  //$("img[qbu=module]").remove();
  //$("img[qbu=module]").hide();

  var querystring=document.location.search;

  if (/dlta=mog/i.test(querystring)) {
    //GRID EDIT PAGE ========================================
    alert("You are on the Grid Edit Page");

  } else if(/a=er/i.test(querystring)) {
    //EDIT RECORD PAGE ========================================
    alert("You are on the Edit Record Page");

  } else if (/a=API_GenAddRecordForm/i.test(querystring)) {
    //API_GenAddRecordForm PAGE ========================================
    alert("You are on the GenAddRecordForm Page!");

  } else if (/a=GenNewRecord/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    alert("You are on the Add Record Page");

  } else if (/a=nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    alert("You are on the Add Record Page");

  } else if(/a=dr/i.test(querystring)) {
    //DISPLAY RECORD PAGE
    alert("You are on the Display Record Page");
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

  } else if(/a=q/i.test(querystring)) {
    //REPORT PAGE ========================================
    alert("You are on the Report Listing Page");

  } else if(/a=td/i.test(querystring)) {
    //TABLE DASHBOARD PAGE ========================================
    alert("You are on the Table Dashboard Page");

  } else if (/a=FinishEditRecord/i.test(querystring)) {
    //FINISH EDIT RECORD PAGE ========================================
    alert("You are on the Finish Edit Record Page");

  } else if (/a=API_GenAddRecordForm/i.test(querystring)) {
    //API_GenAddRecordForm ========================================
    alert("You are on the API_GenAddRecordForm Page"); 
   
  } else {
    //OTHER PAGE ========================================
    alert("You are on the Some Other Page");
  }

})();
how to change back ground color for entire column data in quick base reports PostURL (function(){
  var querystring=document.location.search;

  if(/a=q/i.test(querystring)) {
    //REPORT PAGE ========================================
    //alert("You are on the Report Listing Page");
    $('#VR_bi5jupdpm_1 td:nth-child(1)').css("cssText", "background-color: #f80c12 !important");
    $('#VR_bi5jupdpm_1 td:nth-child(2)').css("cssText", "background-color: #ff4422 !important");
    $('#VR_bi5jupdpm_1 td:nth-child(3)').css("cssText", "background-color: #feae2d !important");
    $('#VR_bi5jupdpm_1 td:nth-child(4)').css("cssText", "background-color: #aacc22 !important");
    $('#VR_bi5jupdpm_1 td:nth-child(5)').css("cssText", "background-color: #12bdb9 !important");
    $('#VR_bi5jupdpm_1 td:nth-child(6)').css("cssText", "background-color: #3311bb !important");
  }

})();
How Do You Use YQL With QuickBase? PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    //alert("You are on the Add Record Page");

    $("#_fid_6, #_fid_8, #_fid_9, #_fid_10, #_fid_11, #_fid_12, #_fid_13").attr("readonly", "readonly");

    var url1 = "bi5trc6ap?a=dbpage&pagename=jquery.query-yql.js";
    $.getScript(url1, function() {

      $("#_fid_7").on("blur", function() {

        var isbn13 = $(this).val().replace(/\D/g,'');
        $("#_fid_7").val(isbn13);

        var url2 = "http://www.isbnsearch.org/isbn/" + isbn13;

        var sql = "";
        sql += "SELECT * ";
        sql += "FROM html ";
        sql += "WHERE url='" + url2 + "' and xpath='//div[@class=\"bookinfo\"]/*'";

        $.queryYQL(sql, "json", function (data) {

          $("#_fid_6").val(data.query.results.h2); // Title

          _.each(data.query.results.p, function (item) {

            if (item.strong == "ISBN-10:") {
              $("#_fid_8").val(item.a.content); // ISBN-10

            } else if (item.strong == "Authors:") {
              $("#_fid_9").val(item.content); // Author

            } else if (item.strong == "Edition:") {
              $("#_fid_10").val(item.content); //Edition

            } else if (item.strong == "Binding:") {
              $("#_fid_11").val(item.content); // Binding

            } else if (item.strong == "Publisher:") {
              $("#_fid_12").val(item.content); // Publisher

            } else if (item.strong == "Published:") {
              $("#_fid_13").val(item.content);  // Published

            } else if (item.strong == "List Price:") {
              $("#_fid_14").val(item.content);  // List Price
            } 
  
          });
        });
      });
    });
  } 
})();
Is it possible to make a URL-Formula button that shows a javascript pop-up box that shows the contents of a Text-formula field? PostURL (function(){
  var querystring=document.location.search;

  if(/a=dr/i.test(querystring)) {
    //DISPLAY RECORD PAGE
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

    var dbid = "bi8hy82sx";
    var dbidTable = "bi8hy82tt";
    var apptoken = "db4yaczb5e5ywcd4uugtykicbw5";
    $.ajaxSetup({data: {apptoken: apptoken}});

    var promise1 = $.get(dbidTable, {
      act: "API_DoQuery",
      query: "{3.EX." + kRid + "}",
      clist: "7"
    });

    var promise2 = $.get(dbid, {
      a: "dbpage",
      pagename: "QBU_MsgBox.html"
    });

    $.when(promise1, promise2).then(function(queryArgs, templateArgs){ 

      var ipsum = $("ipsum", queryArgs[0]).html();
      var data = {
        heading: "Here is the ispum:",
        message: ipsum
      };
      var template = templateArgs[0];
      var markup = Mustache.render(template, data);

      $("body").append(markup);
      $("img[qbu=module]").replaceWith("<a href=# class=Vibrant onclick=ShowPopupDiv('QBU_MsgBox')>Ipsum?<a>");
      setTimeout(function(){HidePopupDiv('QBU_MsgBox')}, 6000);
    });
  }

})();
Is it possible to perform AVERAGEIF formulas in Quickbase? PostURL (function(){
  var querystring=document.location.search;

  if(/a=dr/i.test(querystring)) {
    //DISPLAY RECORD PAGE
    //alert("You are on the Display Record Page");
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

    var dbid = "bi8vnspwt";
    var qid = "1";
    var fids = "6.8";
    var apptoken = "dhjtxcdd3pfy5ngmgjnbd9vdqpw";

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

    var promise = $.get(dbid, {
      act: "API_DoQuery",
      qid: qid,
      clist: fids
    });

    $.when(promise).then(function(xml) {

      var dataAll = $("record", xml).map(function() {
        return [[parseFloat($("data", this).text()), $("type", this).text()]];
      }).get();

      var dataAlpha = _.select(dataAll, function(item) {
        return item[1] == "Alpha";
      });

      var dataBeta = _.select(dataAll, function(item) {
        return item[1] == "Beta";
      });

      var averageAll = _.reduce(dataAll, function(memo, num) {
        return memo + num[0];
      }, 0) / dataAll.length;

      var averageAlpha = _.reduce(dataAlpha, function(memo, num) {
        return memo + num[0];
      }, 0) / dataAlpha.length;
      
      var averageBeta = _.reduce(dataBeta, function(memo, num) {
        return memo + num[0];
      }, 0) / dataBeta.length;
      
      var data = {
        averageAll: averageAll,
        averageAlpha: averageAlpha,
        averageBeta: averageBeta
      };

      var template = "Overall Average: {{averageAll}} <br/>Alpha Average: {{averageAlpha}} <br/>Beta Average: {{averageBeta}}";
      var markup = Mustache.render(template, data);
      $("img[qbu=module]").replaceWith(markup);

    });

  }

})();
Report with values from multiple child tables PostURL (function(){
  var querystring=document.location.search;

  if(/a=dr/i.test(querystring)) {
    //DISPLAY RECORD PAGE
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

    var dbidContacts = "bi8ycjbpc";
    var dbidAddresses = "bi8ycjbqd";
    var dbidPhones = "bi8ycjbrh";
    var apptoken = "csy9r35dg8brqdd56uc7cbeeh6qh";
    $.ajaxSetup({data: {apptoken: apptoken}});

    var promise1 = $.get(dbidAddresses, {
      act: "API_DoQuery",
      query: "{11.EX." + kRid + "}",
      clist: "6.7.8.9.10"
    });

    var promise2 = $.get(dbidPhones, {
      act: "API_DoQuery",
      query: "{8.EX." + kRid + "}",
      clist: "6.7"
    });

    $.when(promise1, promise2).then(function(argsAddresses, argsPhones) {
      xmlAddrresses = argsAddresses[0];
      xmlPhones = argsPhones[0];

      var data = {};
      data.addresses = [];
      data.phones = [];

      $("record", xmlAddrresses).each(function() {
        data.addresses.push({
          short_name: $("short_name", this).text(),
          address: $("address", this).text(),
          city: $("city", this).text(),
          state: $("state", this).text(),
          zip: $("zip", this).text(),
        });
      });

      $("record", xmlPhones).each(function() {
        data.phones.push({
          short_name: $("short_name", this).text(),
          phone: $("phone", this).text()
        });
      });

      var templateURL = "https://haversineconsulting.quickbase.com/db/bi8ycjbne?a=dbpage&pagename=template.txt";
      var promise3 = $.get(templateURL);
      $.when(promise3).then(function(template) {
        var markup = Mustache.render(template, data);
        $("img[qbu=module]").replaceWith(markup);
      });

    });


  } 

})();
Embed Video in a Record PostURL (function(){
  var querystring=document.location.search;

  if(/a=q/i.test(querystring)) {
    //REPORT PAGE ========================================
    alert("You are on the Report Listing Page");

    var markup;
    $("div[data-videoid]").each(function() {
      markup = '<iframe width="640" height="480" src="//www.youtube.com/embed/' + $(this).data("videoid") + '" frameborder="0" allowfullscreen></iframe>';
      $(this).html(markup);
    });

  }

})();
Using a field to redirect records to a custom form? PostURL (function(){
  var querystring=document.location.search;
  var action = "";
  if(/a=er/i.test(querystring)) {
    //EDIT RECORD PAGE ========================================
    //alert("You are on the Edit Record Page");
    action = "er";

  } else if(/a=dr/i.test(querystring)) {
    //DISPLAY RECORD PAGE
    //alert("You are on the Display Record Page");
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");
    action = "dr";
  }

  var dbid = "";
  var promise = $.get(dbid, {
    act: "API_DoQuery",
    query: "{3.EX." + kRid + "}",
    clist: "6"
  });

  $.when(promise).then(function(xml) {
    var phase = $("phase", xml).text();
    if (phase == "Initiating") {
      document.location.href = dbid +"?a=" + action + "&rid=" + kRid + "&dfid=10";
    } else {
      document.location.href = dbid +"?a=" + action + "&rid=" + kRid + "&dfid=11";      
    }
  })
})();
Is there a way to add a button to a record that will cause a change to be made to the record when clicked? PostURL (function(){
  var querystring=document.location.search;
  var dbid = "bjdv4942n";
  var apptoken = "dwhtk8gdutnjhbcvukfsdwc7fsx";
  $.ajaxSetup({data: {apptoken: apptoken}});

  if(/a=q/i.test(querystring)) {
    //REPORT PAGE ========================================
    //alert("You are on the Report Listing Page");
    $(".QBU_ChangeRSVP").on("click", function() {
      var rid = $(this).closest("tr[id^=rid]").attr("id").replace("rid","");
      var promise = $.get(dbid, {
        act: "API_EditRecord",
        rid: rid,
        _fid_9: "NO"
      });
      $.when(promise).then(function(xml) {
        document.location.reload(true);
      });
    });
  }

})();
How can I launch a custom code page from records a standard QuickBase report page, and have them display in a pop-up window? PostURL (function(){
  var querystring=document.location.search;
  var dbid = "bjdv4942n";
  var apptoken = "dwhtk8gdutnjhbcvukfsdwc7fsx";
  $.ajaxSetup({data: {apptoken: apptoken}});

  if(/a=q/i.test(querystring)) {
    //REPORT PAGE ========================================
    //alert("You are on the Report Listing Page");
    $(".QBU_MyButton").on("click", function() {
      var rid = $(this).closest("tr[id^=rid]").attr("id").replace("rid","");
      alert(rid);
    });
  }

})();
Add a Save button and redirect to the home page (this is not the main form in my table) PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    //alert("You are on the Add Record Page");

    $("#RedirectURL").val(gReqAppDBID);
    $("input[name=rl]").val("");

  }

})();
Record IDs returned from an ImportFromCSV API call PostURL $(function(){

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

  var getRids = function(dbid, clist, csv) {
    return $.Deferred(function(dfd) {
      var promise = $.post(dbid, {
        act: "API_ImportFromCSV",
        records_csv: csv,
        clist: clist
      });

      $.when(promise).then(function(xml) {
        var rids = $("rids rid", xml).map(function() {
          return $(this).text();
        }).get();
        dfd.resolve(rids);
      });
    }).promise();            
  };

  var dbid = "pre65ehwr";
  var clist = "6.7.8";
  csv = "1,2.3\n4,5,6";

  getRids(dbid, clist, csv).then(function(rids){
    console.log(rids);
  });

});
Help Formulating a Voice Pick Code PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {
    //EDIT RECORD PAGE ========================================
    //alert("You are on the Edit Record Page");

    var crcTable = new Array(
      0x0000,0xC0C1,0xC181,0x0140,0xC301,0x03C0,0x0280,0xC241,0xC601,0x06C0,0x0780,0xC741,0x0500,
      0xC5C1,0xC481,0x0440,0xCC01,0x0CC0,0x0D80,0xCD41,0x0F00,0xCFC1,0xCE81,0x0E40,0x0A00,0xCAC1,
      0xCB81,0x0B40,0xC901,0x09C0,0x0880,0xC841,0xD801,0x18C0,0x1980,0xD941,0x1B00,0xDBC1,0xDA81,
      0x1A40,0x1E00,0xDEC1,0xDF81,0x1F40,0xDD01,0x1DC0,0x1C80,0xDC41,0x1400,0xD4C1,0xD581,0x1540,
      0xD701,0x17C0,0x1680,0xD641,0xD201,0x12C0,0x1380,0xD341,0x1100,0xD1C1,0xD081,0x1040,0xF001,
      0x30C0,0x3180,0xF141,0x3300,0xF3C1,0xF281,0x3240,0x3600,0xF6C1,0xF781,0x3740,0xF501,0x35C0,
      0x3480,0xF441,0x3C00,0xFCC1,0xFD81,0x3D40,0xFF01,0x3FC0,0x3E80,0xFE41,0xFA01,0x3AC0,0x3B80,
      0xFB41,0x3900,0xF9C1,0xF881,0x3840,0x2800,0xE8C1,0xE981,0x2940,0xEB01,0x2BC0,0x2A80,0xEA41,
      0xEE01,0x2EC0,0x2F80,0xEF41,0x2D00,0xEDC1,0xEC81,0x2C40,0xE401,0x24C0,0x2580,0xE541,0x2700,
      0xE7C1,0xE681,0x2640,0x2200,0xE2C1,0xE381,0x2340,0xE101,0x21C0,0x2080,0xE041,0xA001,0x60C0,
      0x6180,0xA141,0x6300,0xA3C1,0xA281,0x6240,0x6600,0xA6C1,0xA781,0x6740,0xA501,0x65C0,0x6480,
      0xA441,0x6C00,0xACC1,0xAD81,0x6D40,0xAF01,0x6FC0,0x6E80,0xAE41,0xAA01,0x6AC0,0x6B80,0xAB41,
      0x6900,0xA9C1,0xA881,0x6840,0x7800,0xB8C1,0xB981,0x7940,0xBB01,0x7BC0,0x7A80,0xBA41,0xBE01,
      0x7EC0,0x7F80,0xBF41,0x7D00,0xBDC1,0xBC81,0x7C40,0xB401,0x74C0,0x7580,0xB541,0x7700,0xB7C1,
      0xB681,0x7640,0x7200,0xB2C1,0xB381,0x7340,0xB101,0x71C0,0x7080,0xB041,0x5000,0x90C1,0x9181,
      0x5140,0x9301,0x53C0,0x5280,0x9241,0x9601,0x56C0,0x5780,0x9741,0x5500,0x95C1,0x9481,0x5440,
      0x9C01,0x5CC0,0x5D80,0x9D41,0x5F00,0x9FC1,0x9E81,0x5E40,0x5A00,0x9AC1,0x9B81,0x5B40,0x9901,
      0x59C0,0x5880,0x9841,0x8801,0x48C0,0x4980,0x8941,0x4B00,0x8BC1,0x8A81,0x4A40,0x4E00,0x8EC1,
      0x8F81,0x4F40,0x8D01,0x4DC0,0x4C80,0x8C41,0x4400,0x84C1,0x8581,0x4540,0x8701,0x47C0,0x4680,
      0x8641,0x8201,0x42C0,0x4380,0x8341,0x4100,0x81C1,0x8081,0x4040
    );

    function crcAdd(crc,c) {
      return crcTable[(crc ^ c) & 0xFF] ^ ((crc >> 8) & 0xFF);
    }

    $("#_fid_6, #_fid_7, #_fid_8").on("change", function() {
  
      var gtin = $("#_fid_6").val();
      var lot = $("#_fid_7").val();
      var ptiDate = $("#_fid_8").val();
      var plainText = gtin + lot + ptiDate;

      //var plainText = "1085051000201146587443HG234";
      var len = plainText.length;
      var n;
      var crc;

      crc = 0;

      for (n = 0; n < len; n++) {
        crc = crcAdd(crc, plainText.charCodeAt(n));
      }

      var voiceCode = crc.toString();

      $("#_fid_10").val(voiceCode.substr(-2));
      $("#_fid_11").val(voiceCode.substr(-4, 2));
    });

  } 

})();
What Is The UNOB Technique? PostURL (function(){
  var querystring=document.location.search;
   if(/a=er/i.test(querystring) || /a=dr/i.test(querystring) || /a=q/i.test(querystring) || /a=td/i.test(querystring)) {
    $(".QBU_MyClass").on("click", function(event) {
      var rid = $(event.target)[0].dataset.rid;
      alert("Do Something Impressive\n[Record ID#] = " +rid );
    });
   }
})();
Is there a way to programmatically require a field on a form? I don't want to change the required property on the field itself with the SetFieldProperties API call. PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================

    $("#_fid_6").prop({
      required: true,
      placeholder: "Required"
    });

    $("#_fid_7").prop({
      pattern: "[0-9]{5}(?:-[0-9]{4})?",
      placeholder: "12345-6789"
    });

    $("<input>")
      .prop({
        type: "submit", 
        name: "QBU_submitButton",
        id: "QBU_submitButton"
      })
      .css({display: "none"})
      .insertAfter($("#_fid_6"));

    var originalClickHandler = $("#saveButton").data("events").click[0].handler;
    $("#saveButton").unbind("click");

    $("#saveButton").click(function() {
      if ($("#_fid_6")[0].checkValidity() && $("#_fid_7")[0].checkValidity()) {
        originalClickHandler();
      } else {
        setTimeout(function(){
          $("#QBU_submitButton").click();
        }, 1);
      }
    });

  } 

})();
https://quickbase-community.intuit.com/questions/1153737 PostURL var QBU_labels = [
  "Rose", "Rosa", "Rosabella", "Rosalie", "Rosalind", 
  "Rosalinda", "Rosaline", "Rosamond", "Rosana", "Rosanne", 
  "Rosemarie", "Rosemary", "Rosetta", "Rosie", "Rosina",
  "Primrose", "Briallen", "Raisa", "Róisín", "Roos", 
  "Rosario", "Roza", "Roz", "Rozsa", "Ruusu", 
  "Ruza", "Suri", "Varda"];

var QBU_index = 0;

(function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    //alert("You are on the Add Record Page");

    setInterval(function() {
      $("label[for=_fid_6] b").text(QBU_labels[QBU_index]);
      QBU_index = (QBU_index + 1 ) % QBU_labels.length;
    }, 1000);
  }

})();
I have a field that I want to auto populate with the next available value. PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    //alert("You are on the Add Record Page");

    var dbid = "bjww9s9mu";
    var apptoken = "brfn7qtmaip76dd2uh3db3vq2fn";
    $.ajaxSetup({data: {apptoken: apptoken}});

    var promise = $.get(dbid, {
      act: "API_DoQuery",
      qid: "1",
      clist: "6",
      slist: "6",
      options: "num-1.skp-0.sortorder-D"
    });

    promise.then(function(xml) {
      console.dirxml(xml);
      var lastProjectNumber = $("record policy_number", xml).text();
      $("#_fid_6").val(parseInt(lastProjectNumber, 10) + 1).attr("readonly", "readonly");
    });

  }

})();
Using a field to redirect records to a custom form? PostURL (function(){
  var querystring=document.location.search;

  var dbid = "bjw9judnj";
  var apptoken = "d7xc2nwbgme3enc5ca3tpdtacv4a";
  $.ajaxSetup({data: {apptoken: apptoken}});

  var url = "https://ia600509.us.archive.org/4/items/JeopardyTheme/Jeopardy.mp3";

  var musicEnded = function(url) {
    var music = new Audio(url);
    music.play();
    return $.Deferred(function(dfd) {
      music.addEventListener("ended", function() {
        dfd.resolve();
      });
    }).promise();            
  };

  var action = "";
  if(/a=er/i.test(querystring)) {
    //EDIT RECORD PAGE ========================================
    //alert("You are on the Edit Record Page");
    action = "er";

  } else if(/a=dr/i.test(querystring)) {
    //DISPLAY RECORD PAGE
    //alert("You are on the Display Record Page");
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");
    action = "dr";
  }

  var promise = $.get(dbid, {
    act: "API_DoQuery",
    query: "{3.EX." + kRid + "}",
    clist: "6"
  });

  $.when(musicEnded(url), promise).then(function(musicArgs, queryArgs) {
    var xml = queryArgs[0];
    var phase = $("phase", xml).text();
    if (phase == "Phase 1") {
      document.location.href = dbid +"?a=" + action + "&rid=" + kRid + "&dfid=10";
    } else {
      document.location.href = dbid +"?a=" + action + "&rid=" + kRid + "&dfid=11";      
    }
  });
})();
I am trying to create a Formula - URL field/button that will execute the geolocation function as well as executing a URLencode timestamp. Can anyone help? PostURL (function(){
  var querystring=document.location.search;

   if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    //alert("You are on the Add Record Page");
    navigator.geolocation.getCurrentPosition(function(position) {
      $("#_fid_6").val(position.coords.latitude);
      $("#_fid_7").val(position.coords.longitude);
    });
  }

})();
How Can You Overcome SAME ORIGIN POLICY Without CORS? PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    //alert("You are on the Add Record Page");
    $("#_fid_6, #_fid_11, #_fid_7, #_fid_8, #_fid_9").attr("readonly", "readonly");

    var promise1 = $.get("https://www.google.com/finance/converter?a=1&from=USD&to=BRL");

    promise1.then(function(html) {
      $("#_fid_6").val(parseFloat($("span", html).text()));
    });

    var today = new Date();
    $("#_fid_11").val(today.getMonth() + "/" + today.getDate() + "/" + today.getYear());

    var promise2 = $.get("https://www.thelotter.com/lottery-results/brazil-mega-sena/");
    promise2.then(function(html) {
      $("#_fid_7").val($("#ctl00_ContentPlaceHolderMain_ddlDrawNumber", html).text().match(/\/(\d+)/)[1]);
      $("#_fid_8").val($("#ctl00_ContentPlaceHolderMain_ddlDrawNumber", html).text().match(/\|(.*)/)[1]);
      var lotteryNumber = $("span.results-number", html).map(function() {
          return $(this).text();
        }).get().join("-");
      $("#_fid_9").val(lotteryNumber);
    });
  }

})();
Using the formula ending &z=" & Rurl() or something better to return to parent record in another app PostURL (function(){
  var querystring=document.location.search;
  if (/a=API_GenAddRecordForm/i.test(querystring)) {
    $("input[name=rl]").val("");
    $("#RedirectURL").val("http://www.brasil.gov.br/");
  }
})();
How To Use GenderAPI Sans ItDuzzIt PostURL (function(){
  var querystring=document.location.search;
  $("#_fid_7").attr("readonly", "readonly");
  $("#_fid_8").attr("readonly", "readonly");
  if (/a=er/i.test(querystring) || /nwr/i.test(querystring)) {
    var url = "https://gender-api.com/get";
    var key = "PWboSyMyxuuZNUppMQ"; //Public Client Key for haversineconsulting.quickbase.com
    $("#_fid_6").on("change blur keyup", function() {
       var name = $(this).val();
       //var name = this.value;
       $.get(url, {
        name: name,
        key: key
      }).then(function(data) {
        $("#_fid_7").val(data.gender);
        $("#_fid_8").val(data.accuracy);
      });
    });
  } 
})();
Hi, i want to change the behavior of the Add xx button. I want to redirect it to a custom page that i made. How can i accomplish that? PostURL (function(){
  var dbid = "bj2mgxfyy";
  var apptoken = "dtnqtn5ceifq9qc8pi34t8a4gv9";
  $.ajaxSetup({data: {apptoken: apptoken}});

  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {

    $("#saveAndAnotherMenuOption").hide();

   $("<link>", {
     href: "bj2mgxfvy?a=dbpage&pagename=bootstrap-custom.css",
     rel: "stylesheet"
   }).appendTo("head");

   $("<script>", {
     src: "bj2mgxfvy?a=dbpage&pagename=bootstrap.min.js"
   }).appendTo("head");

    $("form[name=editform]")
      .replaceWith("<div id='QBU_mycontainer' class='bootstrap' style='margin: 10px'></div>");

    $("#QBU_mycontainer").load("bj2mgxfvy?a=dbpage&pagename=myform.html", function() {
      $("#QBU_mycontainer div.row").css({
        marginBottom: "10px"
      });
    });

    var originalClickHandler = $("#saveButton").data("events").click[0].handler;
    $("#saveButton").unbind("click");

    $("#saveButton").on("click", function(event) {
      event.preventDefault();
      var promise = $.post(dbid, {
        act: "API_AddRecord",
        _fid_7: $("#_fid_7").val(),
        _fid_8: $("#_fid_8").val(),
        _fid_9: $("#_fid_9").val(),
      });

      promise.done(function(xml) {
        var rid = $("rid", xml).text()
        document.location.href = dbid + "?a=dr&rid=" + rid;
      });
    });
  } 

})();

########################################

File: myform.html

<div class="container">
  <form role="form" id="QBU_myform" name="QBU_myform" enctype="multipart/form-data">
    <div class="row">
      <label class="col-md-1" for="_fid_7">Name</label>
      <div class="col-md-4"><input type="text" class="form-control" id="_fid_7" name="_fid_7" placeholder="Name"></div>
    </div>
    <div class="row">
      <label class="col-md-1" for="_fid_8">Email</label>
      <div class="col-md-4"><input type="email" class="form-control" id="_fid_8" name="_fid_8" placeholder="Email"></div>
    </div>
    <div class="row">
      <label class="col-md-5" for="_fid_9">Notes</label>
    </div>
    <div class="row">
      <div class="col-md-5"><textarea class="form-control" id="_fid_9" name="_fid_9" placeholder="Enter some notes here"></textarea></div>
    </div>
  </form>
</div>
What is the HTML Everywhere Technique? PostURL (function(){
  var querystring=document.location.search;

  if(/a=q/i.test(querystring)) {
    $(".FirstColumn").each(function() {
      $(this).html($("<div/>").html($(this).html()).text());
    });
  }

})();
How do I force a user to ONLY enter up to 2 decimal places? PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    //alert("You are on the Add Record Page");

    $("#_fid_6").prop({
      pattern: "\\d{2}\\.\\d{2}",
      placeholder: "dd.dd"
    });

    $("#_fid_6").on("blur", function() {
      if (this.validity.patternMismatch) {
        alert("Do You Have Trouble Following Rules? Try Again!");
      }
    });

  } 

})();
I would like to "grab" numbers from a text field and then use the numbers in a calculation. PostURL (function(){
  var querystring=document.location.search;

  if(/a=er/i.test(querystring)) {
    //EDIT RECORD PAGE ========================================
    alert("You are on the Edit Record Page");

    $("#_fid_7").attr("readonly", true);

    $("#_fid_6").on("blur, change, keyup", function() {
      var field = $("#_fid_6").val();
      var terms = field.split(/\D+/g);
      var product = _.reduce(terms, function(memo, item) {
        return item.length > 0 ? item * memo : memo;
      }, 1);
      $("#_fid_7").val(product);
    });

  }

})();
Automatically delete rows in linked tables PostURL (function(){
  var querystring=document.location.search;
   if(/a=dr/i.test(querystring)) {
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");
    var dbidParent = "bj3yt647a";
    var dbidChild = "bj3yt648v";
    var relatedParentFid = "7";
    var apptoken = "bh2zgxtddyi4erbmsmrwhc39if9q";
    $.ajaxSetup({data: {apptoken: apptoken}});
    var newButton = '<li><a href="#" id="deleteCascadeButton" title="Cascade Delete">Cascade Delete</a></li>';
    $("#pageNavBarMoreActionsMenu").append(newButton);
    $("#deleteCascadeButton").on("click", function(evt) {
      evt.preventDefault();
      QB.Dialog.confirm({
        title: "Cascasde Delete Confirmation",
        contents: "This operation will delete the current <b>Parent</b> record and any related <b>Children</b> records and is not reversible. Are you sure you want to perform a cascade delete on this record?",
        contentType: "html",
        id: "QBU_CascadeDelete",
        confirm: {
          text: "Delete Them!",
          focused: true,
          click: function() {
            var promiseParent = $.get(dbidParent, {
              act: "API_DeleteRecord",
              rid: kRid
            });
            var promiseChildren = $.get(dbidChild, {
              act: "API_PurgeRecords",
              query: "{" + relatedParentFid + ".EX." + kRid +"}"
            });
            $.when(promiseParent, promiseChildren ).then(function(agrsParent, argsChildren) {
              document.location.href = dbidParent;
            });
            $(this).dialog("close");
          }
        },
        cancel: {
          click: function() {
            $(this).dialog("close");
          }
        }
      });
    });
  }
})();
What is the "Play the Field" Technique? PostURL (function(){

  var querystring=document.location.search;

  var urlvkbeautify = "bj3wia73a?a=dbpage&pagename=vkbeautify.0.99.00.beta.js";
  var urlmarked = "bj3wia73a?a=dbpage&pagename=marked.js";
  var urlchosen = "https://cdnjs.cloudflare.com/ajax/libs/chosen/1.4.2/chosen.jquery.js";
  var csschosen = "https://cdnjs.cloudflare.com/ajax/libs/chosen/1.4.2/chosen.css";

  var promise1 = $.getScript(urlvkbeautify);
  var promise2 = $.getScript(urlmarked);
  var promise3 = $.getScript(urlchosen );

  $("head").append("<link href='" + csschosen + "' type='text/css' rel='stylesheet' />");

  $.when(promise1, promise2, promise3).then(function() {

    if(/a=er/i.test(querystring) || /nwr/i.test(querystring)) {

      $("#_fid_6").on("change", function() {
        this.value = vkbeautify.xml(this.value, "  ");
      });

      $("#_fid_14").hide();
      $("<div id='mydiv'></div>").insertAfter("#_fid_14");
      var markup = "";
      markup += "<select id='myselect' multiple>";
      markup += "  <option>Apple</option>";
      markup += "  <option>Banana</option>";
      markup += "  <option>Cherry</option>";
      markup += "  <option>Date</option>";
      markup += "</select>";
      $("#mydiv").html(markup);
      $("#myselect").chosen();
      $("#myselect").val($("#_fid_14").val().split(",")).trigger("chosen:updated");
      $("#myselect").on("change", function() {
        $("#_fid_14").val($("#myselect").chosen().val().join(","));
      });

    } else if(/a=dr/i.test(querystring)) {
      $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");
      var md = $("tr.formRow td:contains(Markdown)").next("td").html().replace(/<br>/g,"");
      $("tr.formRow td:contains(Markdown)").next("td").replaceWith(marked(md));
    }

  });

})();
Can a different default Home Screen be set for Mobile users? PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    //alert("You are on the Add Record Page");

    var dbid = "bj339nb32";
    var dbidStooge = "bj3393pnu";
    var dbidTimesheet = "bj3394kgw";
    var apptoken = "v3snmad7m3vb7b6j2bd8c568jtz";

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

    $("<div id='QBU_table'>").insertAfter("img[qbu=module]");

    $("#_fid_9").on("change", function() {
      //console.log($("#_fid_9").val());
      var ridStooge = $("#_fid_9").val();
      $("#QBU_table").load(dbidTimesheet + "?act=API_GenResultsTable&clist=6.7.8&slist=6&options=sortorder-D&query={9.EX." + ridStooge + "}");
    });

  }

})();
What is the "Play the Field" Technique? PostURL (function(){
  var querystring=document.location.search;

  if(/a=er/i.test(querystring) || /nwr/i.test(querystring)) {

    document.location.hash ="Submit and keep editing!";

    $("#saveButton").text("Sumbit");

    $("<iframe>", {id: "QBU_editform", name: "QBU_editform"})
      .css({display: "none"})
      .appendTo("body")
      .on("load", function() {
        QBbusyHide();
      });

    $("form[name=editform]").prop({target: "QBU_editform"});
  } 


})();
Is there away to edit an error message? PostURL (function(){
  var querystring=document.location.search;
  if (/a=FinishEditRecord/i.test(querystring)) {
    $("#redmsgTable div.AlertMessageDiv").html("<b>Fix Your Mistake - Respect My Authority. <img src=&#039;http://i.imgur.com/FGz6K3e.jpg'></b>");
  }
})();
Count the times a word appears in a text field PostURL (function(){
  var querystring=document.location.search;

  var dbid = "bj4wgaajx";
  var dbidTable = "bj4wgaaj9";
  var apptoken = "cr8tzu5dyt4nndckfm63v6fiais";
  $.ajaxSetup({data: {apptoken: apptoken}});

  if(/a=dr/i.test(querystring)) {

    var $cell = $("img[qbu=module]").closest("td");

    var promise = $.get(dbidTable, {
      act: "API_DoQuery",
      query: "{3.EX." + kRid + "}",
      clist: "7"
    });

    promise.then(function(xml) {
      var text = $("text", xml).text();
      var countCanada = text.match(/Canada/g).length;
      $cell.html(countCanada);
    });
  }

})();
Inputting military time without using the colon (:) PostURL (function(){
  var querystring=document.location.search;

  if(/a=er/i.test(querystring) || /nwr/i.test(querystring)) {

    $("#_fid_7").on("blur", function() {
      var oldValue = this.value;
      var newValue = oldValue
        .replace(/(\d{2})(\d{2})/g, function($0, $1, $2) {
          var hours = parseInt($1, 10);
          var minutes = parseInt($2, 10);
          if (hours < 12) {
            return hours + ":" + ("0" + minutes).substr(-2) + " AM";
          } else {
            return (hours-12) + ":" + ("0" + minutes).substr(-2) + " PM";
          }
        });

      $(this).val(newValue);
    });

  }

})();
Is there a way to make the multiple choice selections boxes of color rather than words? PostURL (function(){
  var querystring=document.location.search;

  if (/a=er/i.test(querystring) || /nwr/i.test(querystring)) {
    $("#_fid_7 option:gt(0)").each(function() {
      $(this).css({backgroundColor: $(this).val()});
    });
  }

})();
Why U No Validate?   (function(){
  var querystring=document.location.search;

  if(/a=er/i.test(querystring) || /nwr/i.test(querystring)) {

    $(_fid_7).attr({
      placeholder: "##-####(#)-####", 
      pattern: "[0-9]{2}-[0-9]{4,5}-[0-9]{4}"
    });

    $(_fid_8).attr({
      placeholder: "#####-###", 
      pattern: "[0-9]{5}[-][0-9]{3}"
    });

    $(_fid_9).attr({
      placeholder: "###.##", 
      pattern: "[0-9]{3}[.][0-9]{2}"
    });

    $(_fid_10).attr({
      placeholder: "###.##", 
      pattern: "[0-9]{3}[.][0-9]{2}"
    });

    $(_fid_8).on("keyup", function(){
      if ($(this).is(":invalid")) {
        $(this).css("color", "red");
      } else {
        $(this).css("color", "#333");
      }
    });

    $(_fid_7).on("blur", function(){
      if ($(this).is(":invalid")) {
        $(this).css("color", "red");
      } else {
        $(this).css("color", "#333");
      }
    });

    var originalClickHandler = $("#saveButton")
     .data("events").click[0].handler;

    $("#saveButton").unbind("click");

    $("#saveButton").click(function() {
      var yours = parseFloat(_fid_9.value);
      var mine = parseFloat(_fid_10.value);
      if (yours > mine) {
        _fid_9.value = mine;
        _fid_10.value = yours;
      }
      originalClickHandler();
    });

  }

})();
I have a table of Events, each Event has an Event Start Date. When entering a new Event, I need to check if the Event Start Date entered already exists. PostURL (function(){
  var querystring=document.location.search;

  if(/a=er/i.test(querystring) || /nwr/i.test(querystring)) {
    var array = ["2015-07-23", "2015-07-25", "2015-07-27", "2015-07-29", "2015-07-31"];
    $(_fid_7).datepicker("option", {
      beforeShowDay: function(date){
        var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
        return [ array.indexOf(string) == -1 ]
      }
    });
  }
})();
How To Globally Replace String In Text Field Automatically? PostURL (function(){
  var querystring=document.location.search;

  if(/a=er/i.test(querystring) || /nwr/i.test(querystring)) {

    data = [{
      name: "smile",
      image: "https://djyqr7fxk5rha.cloudfront.net/smile.png"
    }, {
      name: "relieved",
      image: "https://djyqr7fxk5rha.cloudfront.net/relieved.png"
    }, {
      name: "joy",
      image: "https://djyqr7fxk5rha.cloudfront.net/joy.png"
    }, {
      name: "+1",
      image: "https://djyqr7fxk5rha.cloudfront.net/%2B1.png"
    }, {
      name: "-1",
      image: "https://djyqr7fxk5rha.cloudfront.net/-1.png"
    }];

    var smilieToMarkup = {};
    data.forEach(function(item, index) {
      smilieToMarkup[item.name] = "<img src='" + item.image + "'>";
    });

    $(_fid_7).on("blur", function() {
      this.value = this.value
        .replace(/:(.+?):/g, function($0, $1) {
          return smilieToMarkup[$1];
        });
    });

  }

})();
modification of column width PostURL $(function() {
  var querystring=document.location.search;

  if(/a=q/i.test(querystring)) {
    var url = "https://haversineconsulting.quickbase.com/db/bj6ppmzyf?a=dbpage&pagename=colResizable-1.5.source.js";
    var promise = $.getScript(url);
    promise.then(function() {
      $("table.searchResults").colResizable();
    });
  }

});
How can I repopulate table form fields with previous entry made by a user? PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {
    var dbid = "bj6pt7465";
    var dbidTable = "bj6pt7476";
    var apptoken = "ctnh3egbr9edy936brhpbevxr6e";
    $.ajaxSetup({data: {apptoken: apptoken}});

    var promise = $.get(dbidTable, {
      act: "API_DoQuery",
      qid: "1",
      clist: "6.7.8",
      slist: "1",
      options: "num-1sortorder-D"
    });

    promise.then(function(xml) {
      console.dirxml(xml);
      var city = $("city", xml).text();
      var state = $("state", xml).text();
      $("#_fid_7").val(city);
      $("#_fid_8").val(state);
    });
  } 
})();
Is there a way for me to have a field act as a drawing canvas? PostURL (function(){
  var querystring=document.location.search;

  if (/a=er/i.test(querystring) || /nwr/i.test(querystring)) {

    var url = "bj63jav97?a=dbpage&pagename=sketch.js";

    var promise = $.getScript(url);

    promise.then(function() {

      var markup = '';
      markup += '<div id=QBU_tools sytle="border: 10px solid black">';
      markup += '<a href="#QBU_canvas" data-color="#f00" style="width: 32px; height: 32px; display: inline-block; margin: 0 10px; background: #f00;"></a>';
      markup += '<a href="#QBU_canvas" data-color="#ff0" style="width: 32px; height: 32px; display: inline-block; margin: 0 10px; background: #ff0;"></a>';
      markup += '<a href="#QBU_canvas" data-color="#000" style="width: 32px; height: 32px; display: inline-block; margin: 0 10px; background: #000;"></a>';
      markup += '<a href="#QBU_canvas" data-color="#0f0" style="width: 32px; height: 32px; display: inline-block; margin: 0 10px; background: #0f0;"></a>';
      markup += '<a href="#QBU_canvas" data-color="#0ff" style="width: 32px; height: 32px; display: inline-block; margin: 0 10px; background: #0ff;"></a>';
      markup += '<a href="#QBU_canvas" data-color="#00f" style="width: 32px; height: 32px; display: inline-block; margin: 0 10px; background: #00f;"></a>';
      markup += '<a href="#QBU_canvas" data-color="#f0f" style="width: 32px; height: 32px; display: inline-block; margin: 0 10px; background: #f0f;"></a>';
      markup += '<a href="#QBU_canvas" data-color="#fff" style="width: 32px; height: 32px; display: inline-block; margin: 0 10px; background: #fff;"></a>';
      markup += '<button class="Vibrant Success" id="QBU_capture">Capture</button>';
      markup += '</div>';
      markup += '<canvas width="800" height="300" id="QBU_canvas" style="border: 1px solid #ccc"></canvas>';
      $("img[qbu=module]").replaceWith(markup);

      $("#QBU_canvas").sketch();

      $("#_fid_6").attr("readonly", "readonly");

      $("#QBU_capture").on("click", function() {
        console.log($("#QBU_canvas")[0].toDataURL());
        $("#_fid_6").val($("#QBU_canvas")[0].toDataURL());
        return false;
      });

    });

  }

})();
Google Hangouts using email address field PostURL (function(){
  var querystring=document.location.search;

  if(/a=q/i.test(querystring)) {

    $(".QBU_Hangout").each(function() {
      var email = this.dataset.email;

      $("<g:hangout>")
        .attr({
          render: "createhangout",
          invites: "[{id: '" + email + "', invite_type: 'EMAIL'}]"
        })
        .appendTo(this);

    });

    $.getScript("https://apis.google.com/js/platform.js");
  }

})();
redirect to related record on parent table PostURL (function(){

  var dbid = "bj84wx48n";
  var dbidProjects = "bj84wx49k";
  var dbidTasks = "bj84wx5an";
  var dbidActivities= "bj84wx5b4";

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

  var querystring=document.location.search;

  if (/API_GenAddRecordForm/i.test(querystring)) {

    $("#_fid_7").on("change", function() {
      var relatedTask = _fid_7.value;
      $.get(dbidTasks, {
        act: "API_DoQuery",
        query: "{3.EX." + relatedTask + "}",
        clist: "7"
      }).then(function(xml) {
        var relatedProject = $("related_project", xml).text();
        $("input[name=rl]").val("");
        $("input[name=z]").val("");
        $("#RedirectURL").val("https://haversineconsulting.quickbase.com/db/" + dbidProjects  + "?a=dr&rid=" + relatedProject); 
      });
    }).trigger("change");
  } 

})();
Second try: create a table within a record PostURL (function(){
  var querystring=document.location.search;

  if(/a=dr/i.test(querystring)) {
    //DISPLAY RECORD PAGE
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

    var dbid = "bj92rdpfr";
    var dbidTable1 = "bj92rdpgi";
    var fids = _.range(6, 47);
    var clist = fids.join(".");

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

    var promise1 = $.get(dbidTable1, {  
      act: "API_DoQuery",
      query: "{3.EX." + kRid + "}",
      clist: clist
    });

    var data = {};
    promise1.then(function(xml1) {
      $("record *", xml1).each(function() {
        data[$(this).prop("tagName")] = $(this).text();
      });

      var promise2 = $.get(dbid + "?a=dbpage&pagename=template.html");
      promise2.then(function(template) {
        var markup = Mustache.render(template, data);
        $("img[qbu=module]").replaceWith(markup);
      });

    });

  }

})();

==========

template.html

<style>
  #QBU_mydiv table {
    border-collapse: collapse;
  }

  #QBU_mydiv table, #QBU_mydiv th, #QBU_mydiv td {
    border: 1px solid black;
    padding: 5px;
    text-align: right;
  }
</style>

<div id="QBU_mydiv">
  <table>
    <tr>
      <td>{{f01}}</td>
      <td>{{f02}}</td>
      <td>{{f03}}</td>
      <td>{{f04}}</td>
      <td>{{f05}}</td>
    </tr>
    <tr>
      <td>{{f06}}</td>
      <td>{{f07}}</td>
      <td>{{f08}}</td>
      <td>{{f09}}</td>
      <td>{{f10}}</td>
    </tr>
    <tr>
      <td>{{f11}}</td>
      <td>{{f12}}</td>
      <td>{{f13}}</td>
      <td>{{f14}}</td>
      <td>{{f15}}</td>
    </tr>
    <tr>
      <td>{{f16}}</td>
      <td>{{f17}}</td>
      <td>{{f18}}</td>
      <td>{{f19}}</td>
      <td>{{f20}}</td>
    </tr>
    <tr>
      <td>{{f21}}</td>
      <td>{{f22}}</td>
      <td>{{f23}}</td>
      <td>{{f24}}</td>
      <td>{{f25}}</td>
    </tr>
    <tr>
      <td>{{f26}}</td>
      <td>{{f27}}</td>
      <td>{{f28}}</td>
      <td>{{f29}}</td>
      <td>{{f30}}</td>
    </tr>
    <tr>
      <td>{{f31}}</td>
      <td>{{f32}}</td>
      <td>{{f33}}</td>
      <td>{{f34}}</td>
      <td>{{f35}}</td>
    </tr>
    <tr>
      <td>{{f36}}</td>
      <td>{{f37}}</td>
      <td>{{f38}}</td>
      <td>{{f39}}</td>
      <td>{{f40}}</td>
    </tr>
  </table>
</div>
Save and Position after Save? PostURL (function(){
  var querystring=document.location.search;

  if(/a=er/i.test(querystring)) {

    var key = "QBU/" + gReqUID + "/" + gReqDBID + "/" + gDFID + "/" + "scroll";

    if (key in sessionStorage) {
      $(window).scrollTop(sessionStorage.getItem(key));
    }

    var originalClickHandler = $("#saveButton").data("events").click[0].handler;
    $("#saveButton").unbind("click");
    $("#saveButton").click(function() {
      var scroll = $(window).scrollTop();
      sessionStorage.setItem(key, scroll);
      originalClickHandler();
    });

  }

})();
What is the Save and Scooby Doo Technique? PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {

    $("<iframe>", {id: "QBU_editform", name: "QBU_editform"})
      .css({display: "none"})
      .appendTo("body")
      .on("load", function() {
        if (this.contentDocument.location.href != "about:blank") {
          QBbusyHide();
          var url = this.contentWindow.location.href;
          var rid = ob32decode(url.match(/r=([abcdefghijkmnpqrstuvwxyz23456789]+)/)[1]);

          var markup = "";
          markup += "<h2>You just created a new record with [Record ID#] = " + rid + " !<h2>";
          markup += "<center><img src=&#039;http://vignette3.wikia.nocookie.net/hanna-barbera/images/2/24/Scoobydoo.jpg' height='200'></center>";
          $("<div>").html(markup).dialog({
            title: "Save and Scooby Doo!",
            modal: true,
            close: function(event, ui) {
              document.location.href = gReqDBID + "?a=er&rid=" + rid;
            }
          });
        }
      });
    $("form[name=editform]").prop({target: "QBU_editform"});
  }

  function ob32decode(ob32) {
    var ob32Characters = "abcdefghijkmnpqrstuvwxyz23456789";
    var decode = 0;
    var place = 1;
    for (var counter = ob32.length -1; counter >= 0; counter--) {   
      var oneChar = ob32.charAt(counter);
      var oneDigit = ob32Characters.indexOf(oneChar);
      decode += (oneDigit * place);
      place = place*32;
    }
    return decode;
  }

})();
What is the Save and Scooby Doo Technique? PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {

    $("<iframe>", {id: "QBU_editform", name: "QBU_editform"})
      .css({display: "none"})
      .appendTo("body")
      .on("load", function() {
        QBbusyHide();
        var rid = this.contentWindow.kRid;

        var markup = "";
        markup += "<h2>You just created a new record with [Record ID#] = " + rid + " !<h2>";
        markup += "<center><img src=&#039;http://vignette3.wikia.nocookie.net/hanna-barbera/images/2/24/Scoobydoo.jpg' height='200'></center>";
        $("<div>").html(markup).dialog({
          title: "Save and Scooby Doo!",
          modal: true,
          close: function(event, ui) {
            document.location.href = gReqDBID + "?a=er&rid=" + rid;
          }
        });
      });
    $("form[name=editform]").prop({target: "QBU_editform"});
  }

})();
How do I create a unique project number? PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    //alert("You are on the Add Record Page");

    var dbid = "bkjugeh38";
    var dbidTable1 = "bkjugeh48";
    var apptoken = "dw63e5bch89iudby3mhsrc3n3pbk";
    $.ajaxSetup({data: {apptoken: apptoken}});

    $.getScript("https://quickbase.intuitcdn.net/res/70087-8/js/date.js")
      .then(function() {
        var fid = "6";
        var fieldLabel = "project_number";

        $("#_fid_" + fid).attr("readonly", true);
        var yymm = Date.today().toString("yy-MM");

        $.get(dbidTable1, {
          act: "API_DoQuery",
          query: "{" + fid + ".SW." + yymm + "}",
          clist: fid,
          slist: fid,
          options: "num-1.sortorder-D"
        }).then(function(xml) {
          var lastProjectNumber = $(fieldLabel, xml).text();
          var lastSessionNumber = lastProjectNumber.split("-")[2] || "0";
          var newSessionNumber = parseInt(lastSessionNumber, 10) + 1;
          var newProjectNumber = yymm + "-" + newSessionNumber;
          $("#_fid_" + fid).val(newProjectNumber);
        });
      })
  }

})();
Survey with multiple forms - need to improve navigation with buttons PostURL (function(){
  var dbid = "bkjvdanjg";
  var dbidTable = "bkjvdank7";

  var querystring=document.location.search;

  if (/nwr/i.test(querystring) || /er/i.test(querystring)) {

    $("<iframe>", {id: "QBU_editform", name: "QBU_editform"})
      .css({display: "none"})
      .appendTo("body")
      .on("load", function() {
        QBbusyHide();
        var url = this.contentWindow.location.href;
        var rid = this.contentWindow.kRid;
        var dfid = GetValue("dfid");

        if (dfid == "2") {
          document.location.href = dbidTable + "?a=er&rid=" + rid + "&dfid=10";
        } else if (dfid == "10") {
          document.location.href = dbidTable + "?a=er&rid=" + rid + "&dfid=11";
        } else if (dfid == "11") {
          document.location.href = dbidTable + "?a=dbpage&pagename=thanks.html";
        }

      });
    $("form[name=editform]").prop({target: "QBU_editform"});
  }


})();
How can I use Google's PageSpeed Insights API with my App? PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    //alert("You are on the Add Record Page");

    $("#_fid_6").on("change", function() {
      var targetURL = $(this).val();

      var url = "https://haversineconsulting.quickbase.com/up/bkjr2y7q3/g/rb/eg/va/ajax_loader_blue_128.gif";
      var $spinner = $("<img id='QBU_Spinner'>");
      $spinner.attr("src", url)
        .css({
          position: "fixed",
          zIndex: 99999,
          top: (($(window).height() - $spinner.outerHeight())/ 2 + $(document).scrollTop()),
          left: (($(window).width() - $spinner.outerWidth())/ 2 + $(document).scrollLeft())
        })
        .prependTo("body");

      var url= "https://www.googleapis.com/pagespeedonline/v1/runPagespeed";
      $.ajax(url, {
        dataType: 'jsonp',
        data: {
          url: targetURL
        }
      }).then(function(response) {
        $("#_fid_7").val(JSON.stringify(response, null, "  "));
        $spinner.hide();
        console.dir(response);
        console.log(JSON.stringify(response, null, "  "));
      });
    });

  }

})();
How can I lookup a value from a master table into a detail table based on two criteria (two separate fields) in a detail table? PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {

    var promiseMoney = $.getScript("https://cdnjs.cloudflare.com/ajax/libs/money.js/0.2.0/money.min.js");

    var promiseRates = $.ajax({
      url: "https://api.fixer.io/latest",
      dataType: "jsonp",
      data: {
        base: "USD"
      }
    }).then(function(result) {
        console.log(JSON.stringify(result, null, "  "));
    });

    $.when(promiseMoney, promiseRates).then(function(argsMoney, argsRates) {
      var rates = argsRates[0].rates;

      $("#_fid_7").on("change", function() {
        var dollars = $(this).val();

        $("#_fid_8" ).val(dollars * rates.AUD).attr("readonly", true);
        $("#_fid_9" ).val(dollars * rates.BGN).attr("readonly", true);
        $("#_fid_10").val(dollars * rates.BRL).attr("readonly", true);
        $("#_fid_11").val(dollars * rates.CAD).attr("readonly", true);
        $("#_fid_12").val(dollars * rates.CHF).attr("readonly", true);
        $("#_fid_13").val(dollars * rates.CNY).attr("readonly", true);
        $("#_fid_14").val(dollars * rates.CZK).attr("readonly", true);
        $("#_fid_15").val(dollars * rates.DKK).attr("readonly", true);
        $("#_fid_16").val(dollars * rates.EUR).attr("readonly", true);
        $("#_fid_17").val(dollars * rates.GBP).attr("readonly", true);
        $("#_fid_18").val(dollars * rates.HKD).attr("readonly", true);
        $("#_fid_19").val(dollars * rates.HRK).attr("readonly", true);
        $("#_fid_20").val(dollars * rates.HUF).attr("readonly", true);
        $("#_fid_21").val(dollars * rates.IDR).attr("readonly", true);
        $("#_fid_22").val(dollars * rates.ILS).attr("readonly", true);
        $("#_fid_23").val(dollars * rates.INR).attr("readonly", true);
        $("#_fid_24").val(dollars * rates.JPY).attr("readonly", true);
        $("#_fid_25").val(dollars * rates.KRW).attr("readonly", true);
        $("#_fid_26").val(dollars * rates.MXN).attr("readonly", true);
        $("#_fid_27").val(dollars * rates.MYR).attr("readonly", true);
        $("#_fid_28").val(dollars * rates.NOK).attr("readonly", true);
        $("#_fid_29").val(dollars * rates.NZD).attr("readonly", true);
        $("#_fid_30").val(dollars * rates.PHP).attr("readonly", true);
        $("#_fid_31").val(dollars * rates.PLN).attr("readonly", true);
        $("#_fid_32").val(dollars * rates.RON).attr("readonly", true);
        $("#_fid_33").val(dollars * rates.RUB).attr("readonly", true);
        $("#_fid_34").val(dollars * rates.SEK).attr("readonly", true);
        $("#_fid_35").val(dollars * rates.SGD).attr("readonly", true);
        $("#_fid_36").val(dollars * rates.THB).attr("readonly", true);
        $("#_fid_37").val(dollars * rates.TRY).attr("readonly", true);
        $("#_fid_38").val(dollars * rates.ZAR).attr("readonly", true);
      });
    });

  }

})();
So I would like to connect a record with another record within a table, how? PostURL (function() {
  var querystring=document.location.search;

  var dbid = "bkj62hszt";
  var dbidTable = "bkj62hs22";
  var apptoken = "d6d7q3qf3ytwydn683rndxt42m9";
  $.ajaxSetup({data: {apptoken: apptoken}});

  if(/a=dr/i.test(querystring)) {
    //DISPLAY RECORD PAGE
    //alert("You are on the Display Record Page");
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

    var mergeWith = $("span.QBU_MergeWith")[0].dataset.mergewith;
    if (mergeWith != "") {
      $.get(dbidTable, {
        act: "API_DoQuery",
        query: "{3.EX." + mergeWith + "}",
        clist: "6"
      }).then(function(xml) {
        var markup = "";
        markup += "";
        markup += '  <tr>';
        markup += '    <td></td>';
        markup += '    <td>' + $("publication", xml).text() + '</td>';
        markup += '  </tr>';

        $("span.QBU_MergeWith").closest("tr").before(markup);
      });
    }
  }

})();
Produce a range of dates from 2 inputs: day-of-week and week-of-month? PostURL (function(){
  var querystring=document.location.search;

  if(/a=dr/i.test(querystring)) {
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

    var dbid = "bkkber4vb";
    var dbidTable1 = "bkkber4v6";
    var apptoken = "bvwha8sc4y9r5pc8k4qkycqc6esf";
    $.ajaxSetup({data: {apptoken: apptoken}});

    $.getScript("https://cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js")
      .then(function() {
        $("span.QBU_Dates").each(function() {
          var dayofweek = this.dataset.dayofweek;
          var ordinal = this.dataset.ordinal;
          console.log(dayofweek, ordinal);

          var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
          var ordinals = ["First", "Second", "Third", "Fourth"];

          var idayofweek = days.indexOf(dayofweek);
          var iordinal = ordinals.indexOf(ordinal) + 1;

          var result = "";
          for (var i=0; i< 12; i++) {
            var dateString = Date.today().addMonths(i)
              .moveToFirstDayOfMonth()
              .moveToNthOccurrence(idayofweek, iordinal)
              .toString("MMM d, yyyy");
            result += dateString + "<br/>";
          }

          $(this).html(result);
        });
      });
 
  }

})();
How do I pick what form I'd like to go to once a record is saved? PostURL (function(){
  var querystring=document.location.search;

  if (/API_GenAddRecordForm/i.test(querystring)) {

    var dbid = "bkkg6s3wk";
    var dbidTable1 = "bkkg6s3x5";
    var dbidTable2 = "bkkg6s3zn";

    $("input[name=z]").val("");

    $("<iframe>", {id: "QBU_editform", name: "QBU_editform", width: "100%", height: "500px"})
      .css({display: "none"})
      .appendTo("body")
      .on("load", function() {
        QBbusyHide();
        var url = this.contentWindow.location.href;
        var rid = ob32decode(url.match(/r=([abcdefghijkmnpqrstuvwxyz23456789]+)/)[1]);

        var markup = "";
        markup += "<h2>You just created a new record with [Record ID#] = " + rid + " !<h2>";
        markup += "<center><img src=&#039;http://vignette3.wikia.nocookie.net/hanna-barbera/images/2/24/Scoobydoo.jpg' height='200'></center>";
        $("<div>").html(markup).dialog({
          title: "Save and Scooby Doo!",
          modal: true,
          close: function(event, ui) {
            document.location.href = dbidTable2 + "?a=er&rid=" + rid;
          }
        });
      });
    $("form[name=editform]").prop({target: "QBU_editform"});
  }

  function ob32decode(ob32) {
    var ob32Characters = "abcdefghijkmnpqrstuvwxyz23456789";
    var decode = 0;
    var place = 1;
    for (var counter = ob32.length -1; counter >= 0; counter--) {   
      var oneChar = ob32.charAt(counter);
      var oneDigit = ob32Characters.indexOf(oneChar);
      decode += (oneDigit * place);
      place = place*32;
    }
    return decode;
  }

})();
Edit a record and redirect to javascript? PostURL //File: module.js

(function(){
  var dbid = "";
  var dbidUserFocus = "";
  var dbidSprayWO = "";
  var apptoken = "";
  $.ajaxSetup({data: {apptoken: apptoken}});

  $("span.QBU_Button").on("click", function() {

    var currentUser = this.dataset.currentuser;
    var rid = this.dataset.rid;

    $.get(dbidUserFocus, {
      act: "API_EditRecord",
      _fid_6: currentUser,
      _fid_36: rid
    }).then(function(xml) {
      $.get(dbidSprayWO, {
        act: "API_CopyMasterDetail",
        relfids: 41,
        recurse: false,
        copyFid: 654,
        destrid: 0,
        sourcerid: rid
      }).then(function(xml) {
        //throw up dialog or run additional code
      });
    });
  });
})();
Can QuickBase receive & display location information from a Field Tech's phone? PostURL (function(){

  var dbid = "bi5963543";
  var dbidStores = "bi596357f";
  var dbidSearches = "bkkxm2a9w";
  var dbidSearchResults = "bkkxnax77";
  var apptoken = "bpz3ecbcr3jhx8dj4ngkb4vfii3";
  $.ajaxSetup({data: {apptoken: apptoken}});

  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {

    var lat1, lon1, rid;

    var promiseStores = $.ajax({
      url: dbidStores, 
      data: {
        act: "API_DoQuery",
        qid: "1",
        clist: "3.10.11"
      },
      dataFilter: XMLFlatToObj
    });

    navigator.geolocation.getCurrentPosition(function(position) {
      lat1 = position.coords.latitude;
      lon1 = position.coords.longitude;
      $("#_fid_7").val(lat1);
      $("#_fid_8").val(lon1);
    });

    $("<iframe>", {id: "QBU_editform", name: "QBU_editform"})
      .css({display: "none"})
      .appendTo("body")
      .on("load", function() {
        QBbusyHide();
        var url = this.contentWindow.location.href;
        rid = ob32decode(url.match(/r=([abcdefghijkmnpqrstuvwxyz23456789]+)/)[1]);

        promiseStores.then(function(stores) {

           lat1 = $("#_fid_7").val();
           lon1 = $("#_fid_8").val();

          _.each(stores.records, function(record, index) {
            var lat2 = record.latitude;
            var lon2 = record.longitude;

            var distance = getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2);
            record.distance = distance;
            record.searchid = rid;
          });
          var records2 = _.chain(stores.records)
            .sortBy(function(record) {
              return record.distance;
            })
            .first(10)
            .value();

          var csv = [];
          _.each(records2, function(record) {
            var csvLine = [];
            csvLine.push(record["store_id_"]);
            csvLine.push(rid);
            csvLine.push(record["distance"]);
            csv.push(csvLine.join(","));
          });
          var csvData = csv.join("\n");

          $.post(dbidSearchResults, {
            act: "API_ImportFromCSV",
            records_csv: csvData,
            clist: "6.12.16"
          }).then(function() {
            document.location.href = gReqDBID + "?a=dr&rid=" + rid;
          });

        });

      });
    $("form[name=editform]").prop({target: "QBU_editform"});

  } else if (/dr/i.test(querystring)) {
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");
  }
  
  function ob32decode(ob32) {
    var ob32Characters = "abcdefghijkmnpqrstuvwxyz23456789";
    var decode = 0;
    var place = 1;
    for (var counter = ob32.length -1; counter >= 0; counter--) {   
      var oneChar = ob32.charAt(counter);
      var oneDigit = ob32Characters.indexOf(oneChar);
      decode += (oneDigit * place);
      place = place*32;
    }
    return decode;
  }

  function XMLFlatToObj(xml, type) {
    var data = [];
    var record = {};
    $("record", xml).each(function() {
      record = {};
      $(this).children().each(function () {
        record[$(this).prop("tagName")] = $(this).text();
      });
      data.push(record);
    });
    return {records: data};
  }

  function getDistanceFromLatLonInKm(lat1 ,lon1, lat2, lon2) {
    var R = 6371; // Radius of the earth in km
    var dLat = deg2rad(lat2-lat1);  // deg2rad below
    var dLon = deg2rad(lon2-lon1); 
    var a = 
      Math.sin(dLat/2) * Math.sin(dLat/2) +
      Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * 
      Math.sin(dLon/2) * Math.sin(dLon/2)
      ; 
    var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
    var d = R * c; // Distance in km
    return d;
  }

  function deg2rad(deg) {
    return deg * (Math.PI/180)
  }

})();
Can I configure my app so that all fields are in upper case? PostURL (function(){
  var querystring=document.location.search;

  if(/a=er/i.test(querystring) || /nwr/i.test(querystring)) {
    $("input[name^=_fid_], textarea[name^=_fid_]").on("change", function() {
      //$(this).val($(this).val().toUpperCase());
      this.value = this.value.toUpperCase();
    });
  }

})();
Using API to get stock prices PostURL (function(){
  var querystring=document.location.search;

  if (/nwr/i.test(querystring)) {

    $.getJSON("https://finance.google.com/finance/info?client=ig&q=NSE:MSFT,ORCL,AMZN,GOOGL,AAPL&callback=?", function(data) {
      //console.log(JSON.stringify(data, null, "  "));
      $("#_fid_6").val(data[0]["l_cur"]);
      $("#_fid_7").val(data[1]["l_cur"]);
      $("#_fid_8").val(data[2]["l_cur"]);
      $("#_fid_9").val(data[3]["l_cur"]);
      $("#_fid_10").val(data[4]["l_cur"]);
    });
  }
})();
How To Process All Records? PostURL (function(){
  var querystring=document.location.search;

  if(/a=q/i.test(querystring)) {

    var dbid = "bkpdww9ej";
    var dbidTable1 = "bkpdww9hp";
    var dbidTable2 = "bkpd7eu88";
    var apptoken = "jhuhv7bqpnhf7bggq4p9cvquq9r";
    $.ajaxSetup({data: {apptoken: apptoken}});

    var iolFieldLabel = "-";
    var clist = "3.6.7";

    var qid = getQueryVariable("qid");

    $("span.ColumnHeading").filter(function() {
      return $(this).text() == iolFieldLabel;
    }).closest("td").hide();
    $("img[qbu=module]").closest("td").hide();

    $("table[qbdbid=" + dbidTable1  + "] tr:first").before("<tr><td><a href=# id=QBU_Button class='Vibrant Success'>Send To Table #2</a></td></tr>");

    $("#QBU_Button").on("click", function() {
      $.ajax({
        url: dbidTable1, 
        data: {
          act: "API_DoQuery",
          qid: qid,
          clist: clist
        },
        dataFilter: XMLFlatToObj
      }).then(function(resp) {
        alert(JSON.stringify(resp, null, "  "));

        var csv = [];
        var csvLine;
        var csvData;
        resp.records.forEach(function(record) {
          csvLine = [];
          csvLine.push(record.fname);
          csvLine.push(record.lname);
          csvLine.push(1);
          csv.push(csvLine.join(","));
        });
        csvData = csv.join("\n");

        $.post(dbidTable2, {
          act: "API_ImportFromCSV",
          records_csv: csvData,
          clist: "6.7.8"
        }).then(function(xml) {
          document.location.href = dbidTable2 + "?a=q&qid=1";
        });

      });
    });
  };

  function getQueryVariable(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split('&');
    for (var i = 0; i < vars.length; i++) {
      var pair = vars[i].split('=');
      if (decodeURIComponent(pair[0]) == variable) {
        return decodeURIComponent(pair[1]);
      }
    }
    console.log('Query variable %s not found', variable);
  }

  function XMLFlatToObj(xml, type) {
    var data = [];
    var record = {};
    $("record", xml).each(function() {
      record = {};
      $(this).children().each(function () {
        record[$(this).prop("tagName")] = $(this).text();
      });
      data.push(record);
    });
    return {records: data};
  }

})();
I have a multiple choice field, but while saving I want each choice to be saved as different records. Does QB provide some functionality to clean up my data like this? PostURL (function(){
  var querystring=document.location.search;

  var dbid = "bkpfunped";
  var dbidTable = "bkpfunpfa";
  var apptoken = "bkby9e5w2atbmpej9zbbwkvq9f";
  $.ajaxSetup({data: {apptoken: apptoken}});

  if(/a=q/i.test(querystring)) {

    $.when(
      $.ajax({
        url: dbidTable, 
        data: {
          act: "API_DoQuery",
          qid: 1,
          clist: "a"
        },
        dataFilter: XMLFlatToObj
      }),
      $.getScript("https://code.highcharts.com/highcharts.js"),
      $.getScript("https://code.highcharts.com/modules/exporting.js")
    ).then(argsResp => {
      var data = _.chain(argsResp[0].records)
        .reduce((memo, record) => {
          return memo.concat(record.field.split(";"));
        }, [])
        .flatten()
        .countBy()
        .value();

      $("#reportMain").highcharts({
        chart: {type: 'column'},
        xAxis: {
          categories: _.keys(data),
          title: {text: "X axis"}
        },
        yAxis: {
          min: 0,
          title: {text: "Y axis"}
        },
        series: [{
          name: 'Data',
          data: _.values(data)
        }]
      });
    });
  };

  function XMLFlatToObj(xml, type) {
    var data = [];
    var record = {};
    $("record", xml).each(function() {
      record = {};
      $(this).children().each(function () {
        record[$(this).prop("tagName")] = $(this).text();
      });
      data.push(record);
    });
    return {records: data};
  }

})();
Create a number sequence starting at zero based and on another fields data. PostURL (function() {

  var querystring=document.location.search;

  var dbid = "bkw7b4gwe"
  var dbidTable1 = "bkw7b4gxt";
  var apptoken = "cfnbbpgdxe8mspdc6a2qycrdvkph";
  $.ajaxSetup({data: {apptoken: apptoken}});

  if (/a=nwr/i.test(querystring)) {
    $("#_fid_7").attr("readonly", "true");

    $("#_fid_6").on("change", function() {
      $.get(dbidTable1, {
        act: "API_DoQuery",
        query: "{6.EX." + $("#_fid_6").val() + "}",
        slist: "7",
        clist: "7",
        options: "num-1.sortorder-D"
      }).then(function(xml) {
        var lastDocNumber = parseInt($("doc_number", xml).text(), 10) || 0;
        var nextDocNumber = (lastDocNumber + 1).toString();
        var pad = "000";
        $("#_fid_7").val(pad.substring(0, pad.length - nextDocNumber.length) + nextDocNumber);
      });
    }); 

  }

})();


Is there a way to only allow certain dates to be selected in a date field PostURL (function(){
  var availableDates = ["6/21/2016", "6/23/2016", "6/25/2016", "6/26/2016"];
  var querystring = document.location.search;

  if(/a=er/i.test(querystring) || /a=nwr/i.test(querystring)) {
    var options = $(this).datepicker("option", "all");
    $("#_fid_6").datepicker("destroy").datepicker($.extend(options, {
      beforeShowDay: function (date) {
        tempDate = (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear();
        if ($.inArray(tempDate, availableDates) != -1) {
          return [true, "", "Available"];
        } else {
          return [false, "", "Not Available"];
        }
      }
    }));
  }
})();
Show X amount of fields in a form PostURL (function(){
  //$("img[qbu=module]").remove();
  //$("img[qbu=module]").hide();

  var querystring=document.location.search;

  if (/a=GenNewRecord/i.test(querystring) || /a=nwr/i.test(querystring)) {

    $("#_fid_6").on("change", function() {
      var n = parseInt($("#_fid_6").val(), 10);

      var fidsShow = _.range(7, 7 + n);
      var fidsHide = _.range(7 + n, 107);

      var fidIDsShow = _.chain(fidsShow)
        .map(function(index) {
          return "#_fid_" + index;
        }).value().join(",");
      $(fidIDsShow).closest("tr.formRow").show();

      var fidIDsHide = _.chain(fidsHide)
        .map(function(index) {
          return "#_fid_" + index;
        }).value().join(",");
      $(fidIDsHide).closest("tr.formRow").hide();

    });
  }

})();
Is there a way to pad the left margin of form with space, basically an indentation of the fields by whatever # pixels I specify? PostURL (function(){
  //$("img[qbu=module]").remove();
  //$("img[qbu=module]").hide();

  var querystring=document.location.search;

  if (/a=nwr/i.test(querystring)) {
    //ADD RECORD PAGE ========================================
    alert("You are on the Add Record Page");

    //$("#formContentsContainer").css("padding-left", "400px");

    $("#formContentsContainer").animate({
      "padding-left": "400px"
    }, 10000);
  } 

})();
What Chart Enhancements Do You Need? PostURL (function(){

  var querystring=document.location.search;

    var urlChart = "https://haversineconsulting.quickbase.com/db/bk84gnxdr?a=q&qid=5";
    var win = window.open(urlChart, "Modified Chart");
   
    $(win.document).ready(function() {
      console.log("hi");
      setTimeout(function() {
        var injectedScript = "<script>";
        injectedScript += "var chart = Highcharts.charts[0];";
        injectedScript += "var options = chart.options;";
        injectedScript += "chart.destroy();";
        injectedScript += "options.yAxis[0].min = 0;";
        injectedScript += "options.yAxis[0].max = 80;";
        injectedScript += "new Highcharts.Chart(options);";
        injectedScript += "</script>";
        win.$(win.document.body).append(injectedScript);
      }, 2000);
    });
})();
How do I show a form as the default view (landing page) when selecting a table? Not a report. PostURL (function(){

  var querystring=document.location.search;

  if (/a=td/i.test(querystring)) {
    alert("You are on the Table Dashboard / Homepage");
    document.location.href = "bmaa988nc?a=dr&rid=1&dfid=10"

  }

})();
Can you cross reference two columns of information PostURL (function() {
  //$("img[qbu=module]").remove();
  //$("img[qbu=module]").hide();

  var querystring = document.location.search;

  if (/a=nwr/i.test(querystring) || /a=er/i.test(querystring)) {

    $("#_fid_6").on("change", function() {
      var index = $(this)[0].selectedIndex;
      $("#_fid_7")[0].selectedIndex = index;
    });

    $("#_fid_7").on("change", function() {
      var index = $(this)[0].selectedIndex;
      $("#_fid_6")[0].selectedIndex = index;
    });

  }

})();
Hi, I want to get the running Total in a Chart. How can I do this.WE have a Table with all registered Users of a Website and we want to show in a line CHart the Totals PostURL (function() {

  var querystring = document.location.search;

  var urlChart = "https://haversineconsulting.quickbase.com/db/bk84gnxdr?a=q&qid=5";
  var win = window.open(urlChart, "Modified Chart");

  $(win.document).ready(function() {
    console.log("hi");
    setTimeout(function() {
      var injectedScript = "<script>";
      injectedScript += "var chart = Highcharts.charts[0];";
      injectedScript += "var options = chart.options;";
      injectedScript += "chart.destroy();";

      injectedScript += "var sum = 0;";
      injectedScript += "options.series[0].data.forEach(function(item,index) {";
      injectedScript += "sum += item.y;";
      injectedScript += "item.y = sum;";
      injectedScript += "});";

      injectedScript += "new Highcharts.Chart(options);";
      injectedScript += "</script>";
      win.$(win.document.body).append(injectedScript);
    }, 2000);
  });
})()
Creating 2 records (in two different apps) using only 1 form PostURL (function(){

  var querystring=document.location.search;

  var dbid = "bmb84cqgp";
  var dbidTable1 = "bmb84cqj4";
  var dbidTable2 = "bmb84dyku";
  var dbidTable3 = "bmb84eu8f";
  
  if (/a=nwr/i.test(querystring)) {
    var originalClickHandler = $("#saveButton").data("events").click[0].handler;
    $("#saveButton").unbind("click");

    $("#saveButton").click(function() {
      form = new FormData($("form[name=editform]")[0]);
      form.set("subact", "save");

      var promise1 = fetch(dbidTable1 + "?a=FinishEditRecord", {
        method: "POST",
        body: form,
        credentials: "include"
      });
      
      var promise2 = fetch(dbidTable2 + "?a=FinishEditRecord", {
        method: "POST",
        body: form,
        credentials: "include"
      });
      
      var promise3 = fetch(dbidTable3 + "?a=FinishEditRecord", {
        method: "POST",
        body: form,
        credentials: "include"
      });
      
      Promise.all([promise1, promise2, promise3]).then(values => {
        window.onbeforeunload = null;
        document.location.href = dbid;
      });
    });
    
  }

})();
Using javascript, I need to limit the amount of form registrations submitted to QuickBase using a predefined number and then show a message if this is ever reached. PostURL (function(){

  var querystring=document.location.search;
  var dbid = "bmfxpym6r";
  var dbidPresentations = "bmfxpynfw";
  var dbidAttendees = "bmfxpynhp";
  var apptoken = "cbfbaunbuz82czd84k582ddzb8yi";
  $.ajaxSetup({data: {apptoken: apptoken}});
  
  if (/a=API_GenAddRecordForm/i.test(querystring)) {
    $("#_fid_9").prop("disabled", true);
    
    var ridPresentation = $("#_fid_9").val();
    console.log(ridPresentation);
   
    var promiseAttendees = $.get(dbidAttendees, {
      act: "API_DoQuery",
      query: "{9.EX." + ridPresentation + "}",
      clist: "3.13"
    }).then(function(xml) {
      var num = $("record", xml).length;
      var capacity =  $("record:first presentation___capacity", xml).text();
      if (num >= capacity) {
        $("form[name=editform] :input").attr("disabled", true);
        alert("Unfortunately this popular presentation is at capacity. Suffer.")
      }
    });
  }

})();
Update report without refreshing entire page, like any modern interface PostURL (function(){
  //$("img[qbu=module]").remove();
  //$("img[qbu=module]").hide();

  var querystring=document.location.search;
  var dbid = "bmgh5p9w2";
  var dbidTable1 = "bmgh5qanv";
  var apptoken = "dn7zhuxcip972eb69qmmwbj7qs9d";
  $.ajaxSetup({data: {apptoken: apptoken}});

  if(/a=q/i.test(querystring)) {
    //REPORT PAGE ========================================
    //alert("You are on the Report Listing Page");
    
    window.setTimeout(function() {
    
      var csv = [];
      var csvLine;
      var csvData;
      
      var statuses = ["Alpha", "Beta", "Gamma", "Delta"];
      var minAmount = 1000;
      var maxAmount = 9999;
      var minRid = 1;
      var maxRid = 30;
      
      for (var i=0; i< 15; i++) {
        csvLine = [];
        csvLine.push(parseInt((Math.random() * (maxRid - minRid + 1)), 10) + minRid);
        csvLine.push(statuses[Math.floor(Math.random() * statuses.length)]);
        csvLine.push(Math.random() * (maxAmount - minAmount) + minAmount);
        csv.push(csvLine.join(","));
      }
      csvData = csv.join("\n");
      console.log(csvData);
      
      $.post(dbidTable1, {
        act: "API_ImportFromCSV",
        records_csv: csvData,
        clist: "3.8.9"
      }).then(function(xml) {
        document.location.reload(true);
      });
    }, 5000);

  }

})();
Is the Function I Want Possible with Scripting (or Anything I Can Learn?) PostURL (function(){

  var dbid = "bmguzsp3f";
  var dbidTable = "bmguzsp87";
  var apptoken = "d57u8padgg33tsbcqhaac4wwxij";
  $.ajaxSetup({data: {apptoken: apptoken}});

  $("div.QBU_Photo").html(function() {
    var photourl = this.dataset.photourl;
    return "<img src=" + photourl + ">";
  });

  $("div.QBU_Photo").closest("tr").attr("canview", false);

  $("table[qbdbid=" + dbidTable  + "] tr:first").before("<tr><td><a href=# id=QBU_Save class='Vibrant Success'>Save</a></td></tr>");

  var fixHelperModified = function(e, tr) {
    var $originals = tr.children();
    var $helper = tr.clone();
    $helper.children().each(function(index) {
      $(this).width($originals.eq(index).width())
    });
    return $helper;
  };

  $("tbody").sortable({
    helper: fixHelperModified,
    stop: function( event, ui ){
      $(this).find('tr').each(function(i){
        $(this).find('td:eq(1)').text(i);
      });
    }
      
  }).disableSelection();

  $("#QBU_Save").on("click", function() {
    var csv_data = "";
    $("table[qbdbid=" + dbidTable  + "] tr[id^=rid]").each(function(index) {
      var rid = $(this).attr("id").substring(3);
      csv_data += rid + "," + (index + 1) + "\n";
    });

    $.post(dbidTable, {
      act: "API_ImportFromCSV",
      records_csv: csv_data,
      clist: "3.13"
    }).then(function(xml) {
      console.dirxml(xml);
    });

  });

})();
I have a multi-select text field with 7 possible choices, is there any way to limit the users to only picking 3? PostURL (function() {

  var querystring=document.location.search;
  var maxSelected = 2;

  if(/a=er/i.test(querystring) || /a=nwr/i.test(querystring)) {

    $("#_fid_6").multiselect({
      click: function(event, ui) {
        var numSelected = $(this).multiselect("getChecked").length;

        if (numSelected > maxSelected) {
          $(this).multiselect("widget").find(":checkbox[value=" + ui.value + "]").prop("checked", false);
        }
      }
    });

  } 

})();
How can I color the background for the column headers in my report? I need 5 subtle colors across by 10 column headers. PostURL (function(){

  var querystring=document.location.search;

  if(/a=q/i.test(querystring)) {
    //REPORT PAGE ========================================
    alert("You are on the Report Listing Page");
    $("table.searchResults thead tr:eq(0) td:eq(1)").css("background-color", "#FFE173");
    $("table.searchResults thead tr:eq(0) td:eq(2)").css("background-color", "#E84F3A");
    $("table.searchResults thead tr:eq(0) td:eq(3)").css("background-color", "#8C4CFF");
    $("table.searchResults thead tr:eq(0) td:eq(4)").css("background-color", "#3AE8E5");
    $("table.searchResults thead tr:eq(0) td:eq(5)").css("background-color", "#B2FF40");

  } 

})();
Can I conditionally display input field in gridview? PostURL (function(){
  $("img[qbu=module]").remove();
  var dbid = "bmhe2ppf6";
  var dbidQuestions = "bmhe2ppma";
  var dbidAnswers = "bmhe4ppma";
  var apptoken = "btb6phex8g3fndpmyy99cz4hkek";
  $.ajaxSetup({data: {apptoken: apptoken}});

  $(".QBU_Div").each(function() {
    var rid = this.dataset.rid;
    var number = this.dataset.number;
    var question = this.dataset.questions;
    var type = this.dataset.type;
    var choices = this.dataset.choices;
    if (type == "Text") {
      $(this).html("<input type=text id=QBU_" + rid + ">");
    } else if (type == "Choice") {
      var markup = "<select id=QBU_" + rid + ">";
      choices.split(",").forEach(function(choice) {
        markup += "<option>" + choice + "</option>";
      });
      markup += "</select>";
      $(this).html(markup);
    }
    
  });

  $("table[qbdbid=" + dbidQuestions + "] tr:first").before("<tr><td><a href=# id=QBU_Button class='Vibrant Success'>Submit Survey</a></td></tr>");

  $("table[qbdbid=" + dbidQuestions + "] tr[id^=rid]").removeAttr("canview");

  $("#QBU_Button").on("click", function() {

    var respondentID = new Date().getTime();
    var csv = $("table[qbdbid=" + dbidQuestions + "] tr[id^=rid]").map(function() {
      var rid = $(this).attr("id").substr(3);
      var div = $("#QBU_" + rid).parent("div")[0];
      var number = div.dataset.number;
      return '"' + respondentID + '","' + number + '","' + $("#QBU_" + rid).val() + '"';
    }).get();

    $.post(dbidAnswers , {
      act: "API_ImportFromCSV",
      clist: "6.8.9",
      records_csv: csv.join("\n"),
    }).then(function(xml) {
      document.location.href = dbidAnswers + "?a=q&query={6.EX." + respondentID + "}";
    });

  });


})();
How to display popup when viewing a record? PostURL (function(){

  var querystring=document.location.search;

  if(/a=er/i.test(querystring) || /a=nwr/i.test(querystring) || /a=dr/i.test(querystring)) {
    var $MyDialog = $("<div id=QBU_MyDialog></div>");

    var content = "";
    content += "<h1>Please file your TPS Report</h1>";
    content += "<img src=https://i.ytimg.com/vi/Fy3rjQGc6lA/hqdefault.jpg>";

    $MyDialog.html(content).dialog({
      modal: true,
      title: "Reminder",
       height: 550,
       width: 500,
      buttons: {
        Close: function() {
          $(this).dialog("close");
        }
      }
    }).dialog("open");
      }

})();
Map route planning for field technicians PostURL (function(){
  var dbid = "bmihnujsy";
  var dbidRoadtrips = "bmihnujwd";
  var dbidWaypoints = "bmihnuj4m";
  var apptoken = "dgt32vdbz3afc2ceddck9rky9qs";
  $.ajaxSetup({data: {apptoken: apptoken}});

  var querystring=document.location.search;

  if (/a=dr/i.test(querystring)) {
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

    $.getScript("https://maps.googleapis.com/maps/api/js?key=AIzaSyC7aRauz_FUvNkkegqNmWil0ZwDimf_pT0",function() {

      var directionsService = new google.maps.DirectionsService;
      var directionsDisplay = new google.maps.DirectionsRenderer;
      var map = new google.maps.Map(document.getElementById("QBU_Map"));

      directionsDisplay.setMap(map);

      $.get(dbidWaypoints, {
        act: "API_DoQuery",
        query: "{9.EX." + kRid + "}",
        clist: "3.7"
      }).then(function(xml) {
        var waypts = [];
        $("record", xml).each(function() {
          waypts.push({
            location: $("address", this).text(),
            stopover: true
          });
        });
        directionsService.route({
          origin: waypts.shift().location,
          destination: waypts.pop().location,
          waypoints: waypts,
          optimizeWaypoints: true,
          travelMode: 'DRIVING'
        }, function(response, status) {
          if (status === 'OK') {
            directionsDisplay.setDirections(response);
          } else {
            alert('Directions request failed due to ' + status);
          }
        });
      });
    });
  } 
})();
What is the Simplest IOL Example? PostURL (function(){
  var querystring=document.location.search;
  if (/a=nwr/i.test(querystring) || /a=er/i.test(querystring)) {
    $("#_fid_6").on("change", function() {
      $("#_fid_6").val($("#_fid_6").val().toUpperCase());
    });
  }
})();
Remove disallowed characters from a text field   (function(){

  var querystring=document.location.search;

  if(/a=er/i.test(querystring) || /a=nwr/i.test(querystring)) {
    $("#_fid_6").on("keyup", function() {
      $("#_fid_6").val($("#_fid_6").val().replace(/['",; ]/, ""));
    })
  }

})();
I WOULD LIKE TO ADD VIDEOS TO TABLES. HOW WOULD I GO ABOUT DOING THAT?   (function(){

  var dbid = "bmkxfnafs";
  var dbidTable = "bmkxfnahr";
  var apptoken = "cpry8s8d2abgq8cm8feiwbd2vvvu";
  $.ajaxSetup({data: {apptoken: apptoken}});

  $("div.QBU_Div").html(function() {
    var youtubeid = this.dataset.youtubeid;
    var markup = `<iframe width=560 height=315 src=https://www.youtube.com/embed/${youtubeid} frameborder=0 allowfullscreen></iframe>`;
    return markup;
  });

})();
How can I make a field editable every time a record is opened, even in view mode?   (function(){

  var dbid = "bmkz323av";
  var dbidTable = "bmkz323rr";
  var apptoken = "gqek6ucaayse7mdwnywdks9b7s";
  $.ajaxSetup({data: {apptoken: apptoken}});

  var querystring=document.location.search;

  if(/a=dr/i.test(querystring)) {

    $("#tdf_0").attr("contenteditable", true)
      .on("input", function() {
        $.post(dbidTable, {
          act: "API_EditRecord",
          rid: kRid,
          _fid_6: this.innerHTML
        });
      });
  }

})();
How to increase map report's height in native Quick Base?   (function(){
  var querystring=document.location.search;

  if (/a=dr/i.test(querystring)) {
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

    $("#mapInline_6").animate({zoom: 2}, 10000, function() {
      $("img[src=&#039;https://maps.gstatic.com/mapfiles/api-3/images/tmapctrl_hdpi.png']:eq(1)").click();
    });
  }
})();
Multi User Select Field Colorization   (function(){
  $("span.wrapper.slk:contains(Jack)").css("background-color", "#7879FB");
  $("span.wrapper.slk:contains(Carol)").css("background-color", "#EA7B91");
  $("span.wrapper.slk:contains(Barbara)").css("background-color", "#AB8BC3");
  $("span.wrapper.slk:contains(Janet)").css("background-color", "#F8F481");
})();
Multi User Select Field Colorization   (function(){

  $(window).on("hashchange", function() {
    $("span.wrapper.slk:contains(Jack)").css("background-color", "#7879FB");
    $("span.wrapper.slk:contains(Carol)").css("background-color", "#EA7B91");
    $("span.wrapper.slk:contains(Barbara)").css("background-color", "#AB8BC3");
    $("span.wrapper.slk:contains(Janet)").css("background-color", "#F8F481");
  }).trigger("hashchange");

})();
Embed Custom HTML   (function(){
  $("img[qbu=module]").remove();

  var dbid = "bmnf7nrp3";
  var dbidClientss = "bmnf7nrvf";
  var dbidAppointments = "bmnf7nrye";
  var apptoken = "ctkk6cjby7ugpndh68zw2cpaqpvf";
  $.ajaxSetup({data: {apptoken: apptoken}});

  var querystring=document.location.search;

  if(/a=q/i.test(querystring) || /a=td/i.test(querystring)) {
    $(".QBU_ToggleChildren").one("click", function() {
      var rid = this.dataset.rid;
      var markup = "";
      var $row = $(this).closest("tr");
      $.get(dbidAppointments, {
        act: "API_GenResultsTable",
        query: "{9.EX." + rid + "}",
        clist: "3.6.7.8"
      }).then(function(html) {
        $row.closest("tr").after("<tr id='child_rid_" + rid + "'><td colspan=2>foobar</td><td colspan=*>" + html + "</td></tr>");
      });
    });
    
    $(".QBU_ToggleChildren").on("click", function() {
      if ($(this).text() == "+") {
        $(this).text("-");
      } else {
        $(this).text("+");
      }
      var rid = this.dataset.rid;
      $("#child_rid_" + rid).toggle();
    });
  }

})();
Automatic assignment of case to worker   (function(){

  var dbid = "bmnpvxnb7";
  var dbidWorkers = "bmnpvxnfk";
  var dbidJobs = "bmnpvxngn";
  var apptoken = "b72nzhj58ftqjbzw8pw6trqnq5";
  $.ajaxSetup({data: {apptoken: apptoken}});

  var action = "API_GenResultsTable";
  var qid = "1";
  var clist = "3.11";
  
  var querystring=document.location.search;
  
  if (/a=nwr/i.test(querystring)) {

    var url = `${dbidJobs}?act=${action}&act=API_GenResultsTable&qid=${qid}&clist=${clist}&jsa=1`;
    $.getScript(url)
      .then(function() {
        var dataJobs =  _.countBy(qdb_data, 1);
        var ridSelectedWorker = +_.chain(dataJobs).pairs().min(function(x){return x[1];}).value()[0];
        $("#_fid_11").val(ridSelectedWorker);
      });
  }

})();
Formula to number each child record as related to parent record   (function(){

  var querystring=document.location.search;

  var dbid = "bmnukbwyd";
  var dbidPeople = "bmnukbw5c";
  var dbidThings = "bmnukbw6e";
  var apptoken = "qsmrr2pyhvqfu5ew8tbeexmq";
  $.ajaxSetup({data: {apptoken: apptoken}});

  if(/a=dr/i.test(querystring)) {
    $.get(dbidThings, {
      act: "API_GenResultsTable",
      query: "{8.EX." + kRid + "}",
      clist: "3",
      slist: "7",
      jsa: "1"
    }).then(function() {
      var data = _.pluck(qdb_data, 0);
      var csv = "";

      $("a.QBU_Button").on("click", function(event) {
        if ($(this).hasClass("Arabic")) {
          csv = _.reduce(data, function(memo, rid, index) {
              return memo + "\n" + rid + "," + (index + 1);
            }, "");
        } else if ($(this).hasClass("Roman")) {
           csv = _.reduce(data, function(memo, rid, index) {
              return memo + "\n" + rid + "," + romanize(index + 1);
            }, "");
       } else if ($(this).hasClass("Revision")) {
          csv = _.reduce(data, function(memo, rid, index) {
              return memo + "\n" + rid + "," + toBase26(index);
            }, "");
        }

        $.post(dbidThings, {
          act: "API_ImportFromCSV",
          records_csv: csv,
          clist: "3.6"
        }).then(function(xml) {
          document.location.reload(true);
        });

      });

    });
  }

  function romanize(num) {
    var  digits = String(+num).split(""),
      key = ["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM",
             "","X","XX","XXX","XL","L","LX","LXX","LXXX","XC",
             "","I","II","III","IV","V","VI","VII","VIII","IX"],
      roman = "",
      i = 3;
    while (i--)
      roman = (key[+digits.pop() + (i * 10)] || "") + roman;
    return Array(+digits.join("") + 1).join("M") + roman;
  }

  function toBase26(value) {
    var converted = "",
      iteration = false,
      remainder;
    do {
      remainder = value % 26;
      if (iteration && value < 25) {
        remainder -= 1;
      }
      converted = String.fromCharCode((remainder + 'A'.charCodeAt(0))) + converted;
      value = Math.floor((value - remainder) / 26);
      iteration = true;
    } while (value > 0);
    return converted;
  };

})();
Comparing Multiple Fields in One Pie Chart   (function(){

 $.getScript("https://assets.quickbasecdn.net/res/75091-23/js/highcharts/highcharts.js").then(function() {
    $("div.QBU_Chart").each(function() {

      $("img[qbu=module]").remove();

      var rid = this.dataset.rid;
      var meeting = parseFloat(this.dataset.meeting);
      var rework = parseFloat(this.dataset.rework);
      var overhead = parseFloat(this.dataset.overhead);
      var slack = parseFloat(this.dataset.slack);

      $("#QBU_Chart_" + rid).width(400).height(400).highcharts({
        chart: {
          plotBackgroundColor: null,
          plotBorderWidth: null,
          plotShadow: false,
          type: 'pie'
        },
        title: {
          text: ''
        },
        tooltip: {
          pointFormat: '{series.name}: <b>{point.y}</b>'
        },
        plotOptions: {
          pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
              enabled: true,
              format: '<b>{point.name}</b>: {point.percentage:.1f} %',
              style: {
                color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
              }
            }
          }
        },
        series: [{
          name: 'Hours',
          colorByPoint: true,
          data: [{
            name: 'Meeting',
            y: meeting
          }, {
            name: 'Rework',
            y: rework
          }, {
            name: 'Overhead',
            y: overhead 
          }, {
            name: 'Slack',
            y: slack 
          }]
        }]
      });
    });
  });
})();
Custom Error Message According Unique Fields   (function() {
  var querystring=document.location.search;
  if (/a=FinishEditRecord/i.test(querystring)) {
    var message = 'This Client Already Exists <br><span style="font-size:80%">(The client was not saved)</span>';
    $("#redmsgTable div.AlertMessageDiv b").html(message)
  }
})();
IMA Grandmaster - Does QuickBase Support Chessboard Fields?   (function() {
  $("img[qbu=module]").remove();
  //$("img[qbu=module]").hide();

  var querystring=document.location.search;

  var dbid = "bmpbjbbvr";
  var dbidBoards = "bmpbjbbxx";
  var apptoken = "dd2s3hsbsedikjcqxgby4bbf32na";
  $.ajaxSetup({data: {apptoken: apptoken}});

  var urlChessBoardJS = "https://haversineconsulting.quickbase.com/db/bmpbjbbvr?a=dbpage&pagename=chessboard.js";
  var URLChessBoardCSS = "https://chessboardjs.com/css/chessboard.css";

  $("head").append(`<link rel="stylesheet" href="${URLChessBoardCSS}" type="text/css" />`);

  $.getScript(urlChessBoardJS, function() {
    if (/a=er/i.test(querystring)) {
      $("#_fid_6").attr("readonly", "readonly");
      var rid = $("div.QBU_Board").attr("data-rid");
      $.get(dbidBoards, {
        act: "API_DoQuery",
        query: "{3.EX." + rid + "}",
        clist: "6"
      }).then(function(xml) {
        var position = JSON.parse($("record board_position", xml).text());
        var cfg = {
          draggable: true,
          dropOffBoard: "trash",
          position: position,
          onChange: function(oldPos, newPos) {
            $("#_fid_6").val(JSON.stringify(newPos, null, "  "));
          }
        };
        var board = ChessBoard("QBU_Board_" + rid, cfg);
      });
    }
  });

})();
Does QuickBase Support An Array Of Dates Field?   (function() {
  $("img[qbu=module]").remove();

  var querystring = document.location.search;

  var dbid = "bmpeweq7g";
  var dbidDateLists = "bmpewercv";
  var apptoken = "bv9ufibbt7izdkbw9hkiwdszbijd";
  $.ajaxSetup({data: {apptoken: apptoken}});

  var urlDatePickJS = "https://haversineconsulting.quickbase.com/db/bmpeweq7g?a=dbpage&pagename=jquery.datepick.js";
  var urlPluginJS = "https://haversineconsulting.quickbase.com/db/bmpeweq7g?a=dbpage&pagename=jquery.plugin.js";
  var urlDatePickCSS = "https://haversineconsulting.quickbase.com/db/bmpeweq7g?a=dbpage&pagename=jquery.datepick.css";

  $("head").append(`<link rel="stylesheet" href="${urlDatePickCSS}" type="text/css" />`);

  $.ajax({
    async: false,
    type: 'GET',
    url: urlPluginJS,
    data: null,
    dataType: 'script'
  }).then(function() {
     $.ajax({
      async: false,
      type: 'GET',
      url: urlDatePickJS,
      data: null,
      dataType: 'script'
    }).then(function() {
      if (/a=er/i.test(querystring)) {
        $("#_fid_6").attr("readonly", "readonly");
        var rid = $("div.QBU_DateList").attr("data-rid");
        $.get(dbidDateLists, {
          act: "API_DoQuery",
          query: "{3.EX." + rid + "}",
          clist: "6"
        }).then(function(xml) {
          var datelist = $("record date_list", xml).text();
          $("#QBU_DateList_" + rid).datepick({
            multiSelect: 4,
            multiSeparator: ' | ',
            onSelect: function(dates) {
              var fid6Value = _.map(dates, function(date) {
                return $.datepick.formatDate("mm/dd/yyyy", date);
              }).join(" | ");
              $("#_fid_6").val(fid6Value);
            }
          }).datepick('setDate', datelist.split(" | "));

        });
      }
    });
  });

})();
IMA Graph Theorist - Does QuickBase Support GraphViz Fields?   (function(){
  $("img[qbu=module]").remove();

  var querystring=document.location.search;

  var dbid = "bmpkzhb99";
  var dbidGraphs1 = "bmpkzhcsa";
  var dbidGraphs2 = "bmpk3ibag";
  var apptoken = "cfcbtradb4eb6rdgps9zmbq98ndr";
  $.ajaxSetup({data: {apptoken: apptoken}});

  if(/a=dr/i.test(querystring)) {
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

    var urlViz = "https://cdnjs.cloudflare.com/ajax/libs/viz.js/1.7.1/viz.js";
    $.getScript(urlViz , function() {

      $.get(dbidGraphs1, {
        act: "API_DoQuery",
        query: "{3.EX." + kRid + "}",
        clist: "6"
      }).then(function(xml) {
        var graphvizSource1 = $("graphviz", xml).text();
        console.log(graphvizSource1);
        var graphvizSource2 = $('<textarea />').html(graphvizSource1).text();
        console.log(graphvizSource2);
        $("div.QBU_GraphViz").html(Viz(graphvizSource2, "svg"));
      });
      
    });

  } 

})();
IMA Graph Theorist - Does QuickBase Support GraphViz Fields?   (function(){
  $("img[qbu=module]").remove();

  var querystring=document.location.search;

  var dbid = "bmpkzhb99";
  var dbidGraphs1 = "bmpkzhcsa";
  var dbidGraphs2 = "bmpk3ibag";
  var apptoken = "cfcbtradb4eb6rdgps9zmbq98ndr";
  $.ajaxSetup({data: {apptoken: apptoken}});

  if(/a=dr/i.test(querystring)) {
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

    var urlViz = "https://cdnjs.cloudflare.com/ajax/libs/viz.js/1.7.1/viz.js";
    $.getScript(urlViz , function() {

      $.get(dbidGraphs2, {
        act: "API_DoQuery",
        query: "{3.EX." + kRid + "}",
        clist: "6.8.9.10"
      }).then(function(xml) {
        var graphvizSource1 = $("graphviz", xml).text();
        var grandparent = '"' + $("grandparent", xml).text() + '"';
        var parent = '"' + $("parent", xml).text() + '"';
        var child = '"' + $("child", xml).text() + '"';
        console.log(graphvizSource1);
        var graphvizSource2 = $('<textarea />').html(graphvizSource1).text();
        console.log(graphvizSource2);
        var graphvizSource3 = eval("`" + graphvizSource2 + "`");
        console.log(graphvizSource3);
        $("div.QBU_GraphViz").html(Viz(graphvizSource3, "svg"));
      });
      
    });

  } 

})();
Result Pages:  1  2    

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