Long time user of Knack. Our entire production management and order processing is on Knack and we’d be lost without it.
We’re expanding and getting busier, and its getting harder to get a view of our current situation from reading tables. I recall seeing someone had found a way of producing a ‘tile’ which has, say ‘Order value taken this month’ or number of sales. Both are easy numbers to get at, but not easy to display. Has anyone got something they could suggest or point me at the earlier article. I’ve searched and it just isn’t appearing.
Second, I’ll sneak this in, we take orders direct from clients through a portal, but when they arrive, it sure would be great to be able to hear a ‘ding’, a bell, a claxon, or something else to tell us that we have something to respond to. We have an email notification which dings our phones, but as we work in a busy and noisy environment, they get missed. Same question. Anyone done this already.?
To answer your other question, you can use integromat (now make) to set this up. Maybe do an integration with Twilio to send a text message, or set up an email connector to send you a message anytime a new record is created.
We recently set up a solution using make and Twilio that allows users to use our app to mass text a message to their users after a form submission.
I’ve done the audio part of your question. It’s a dashboard that monitors the Knack devices connected to the App, and validates that they’re up and running 24/7 with heartbeats every minute. Works like a charm. But if ever a sequence of 3 heartbeats are missed, I sound an alert and send myself an email.
So here’s an extract of the code I’ve written to add the playback in the app. You can upload an mp3 of your choice in Knack and get its URL to use as the 2nd parameter.
var alertTriggered = false;
var wantToHearSounds = true;
//audioId is just a unique ID string.
//audioSource is the URL of an mp3 file.
function waitAudioReady(audioId = '', audioSource = '') {
return new Promise(function (resolve, reject) {
var audio = document.getElementById(audioId);
if (audio)
resolve(audio);
else {
audio = document.createElement("AUDIO");
audio.id = audioId;
if (audio && audio.canPlayType("audio/mpeg")) {
audio.setAttribute("src", audioSource);
//Do not show controls. Uncomment next line to show, if ever needed.
//audio.setAttribute("controls", "controls");
document.body.appendChild(audio);
resolve(audio);
} else {
reject('Error - device or browser can\'t play sounds');
}
}
})
}
if (alertTriggered) {
waitAudioReady('deadTerminalAlert', 'https://api.knack.com/v1/applications/YOU_APP_ID/download/asset/SOUND_RECORD_ID/deviceofflinealert.mp3')
.then(function (audioAlert) {
if (audioAlert) {
if (wantToHearSounds)
audioAlert.play();
}
})
.catch(reason => { console.log(reason); })
}
Typically, you add the call to waitAudioReady in a view render handler, and check the values of the tables for some trigger.
Hello Julian–I am relatively new to Knack, but building a database for my business. I was looking to develop some dashboard metrics and came upon your blog post to display KPIs. Love this!
So, I injected your CSS and got the box to work. I then tried to test this out by using a field from a table…but the box just repeated itself with all the different data values for the entire table.
I feel like this is a novice issue I am having, but a key bit I am struggling with is coming up with the single summary data number…i.e. total number of XYZ or summary of a certain column. For example, I may have a table of 20 records and I want to count the number of them that are a certain state from a field and report this.
If you have any lightbulb you can light for me, I would appreciate the support!
Glad you found the post helpful - to display these ‘boxes’ you need to add them to a details view of the record in which they are calculated (so that only one record is displayed). So you would use count, sum, etc fields to get the values you need and then set up the text formula for the ‘box’ to show that value (with the surrounding html).
The implication is that you may need a summary table in which these values are calculated - and that every record in your actual data table would then be connected to the summarising record.
Thank you so much for the direction Julian. Let get under the hood on this and see what I can make happen! First thing is getting into making a summary table. Are you meaning a summary Table (Knack Table) or Pivot Table?
I mean a Knack table- this is where the text formulae and sums go. Of course you may already have a parent table in which these calculations are relevant.
Julian–Thanks so much for the guidance. I did implement the solution and was able to get some good results (see screen shot with some play values and data).