Forum Discussion

_anomDiebolt_'s avatar
Qrew Elite
7 years ago

Are There Any New Pre-Service Worker Disruptive Techniques?

Are There Any New Pre-Service Worker Disruptive Techniques?

2 Replies

  • Sure there are!

    I just slapped together three simple formulas the other day but did not give the common technique a snappy name. How about the OEH Technique - the On Error HTML Technique named of course after the "Ooo - eeeee - hoo!" chant sung by the Winkie Guards in the Wizard of Oz (that is what they are singing  - it is in the script if you don't believe me):

    Well I added fourth formula to the demo which calculates all the prime numbers less than the value in the field [Number]. You can check it out here and even add your own records:

    Well the thing that is special about this new formula is that I didn't write the formula! Here it is but I swear I didn't write this formula:
    "<img src onerror='this.outerHTML=( function(max) { var sieve = [], i, j, primes = []; for (i = 2; i &lt;= max; ++i) { if (!sieve) { primes.push(i); for (j = i &lt;&lt; 1; j &lt;= max; j += i) { sieve = true; } } } return primes.join(&quot;, &quot;); } )(" & [Number] & ")'>"
    Instead I created a very small form to generate the formula from some simple JavaScript pasted into the form. Have a look at the screenshot of the form in action:

    I want to do a little more testing on some more complex JavaScript input but I will be releasing this utility shortly.

    Anyway that's the OEH Technique. It generates a QuickBase formula that displays whatever you want to calculate on your forms and reports and can include arbitrary HTML content. The generated formula is self contained and does not reference any code pages or other external resources.
  • Just an quick update - it looks like we are just going to use a Service Worker to splice the OEH formula generator into the standard field definition page. When you select the checkbox "Enable OEH?" you can then enter your JavaScript and field inputs and the QuickBase formula will be auto-generated without the need to click any extra buttons. Also, so nobody accidentally corrupts the generated formula definition we will make the normal formula entry field readonly. The interface looks like this: