VOLUME XCVI             09/02/2021

Working With Files in the Ninox API: Part 3

By Adam Davidson, Director of Product Development

This time around we will be downloading a file to the user’s device from javascript inside a Ninox formula field.  Please see Part 2 of this series for background, as this article builds on the code there.  

We will modify the code from last week to add a button below each of the file names wwe retrieve from the API.  when the button is clicked, another API call can be made to download the file.

				
					html(" <script>let downloadFile=(fileName)=>{let headers={'Authorization':'Bearer '+'" + apiKey() + "'};let url='https://api.ninox.com/v1/teams/" + teamId() + "/databases/" + databaseId() + "/tables/" + tableId(this) + "/records/" + Id + "/files/'+fileName;fetch(url,{headers:headers}).then(response=>response.blob()).then(blob=>{var url=window.URL.createObjectURL(blob);var a=document.createElement('a');a.href=url;a.download=fileName;document.body.appendChild(a);a.click();a.remove()})}
let getFiles=()=>{let headers={'Authorization':'Bearer '+'" + apiKey() + "'};let url='https://api.ninox.com/v1/teams/" + teamId() + "/databases/" + databaseId() + "/tables/" + tableId(this) + "/records/" + Id + "/files';console.log('hello Adam');fetch(url,{headers:headers}).then(response=>response.json()).then(files=>{let container=document.getElementById('files_conatiner');let html=''
for(let file of files){html+='<div>'+file.name+'</div><button onclick=""downloadFile(\''+file.name+'\')"">download</button>'}
container.innerHTML=html})}</script> <style onload='getFiles()'></style><div id='files_conatiner' onclick='getFiles()'>hello</div>
")

				
			

The button function above, “downloadFile” takes the file’s name and makes a request to the API to get the file. The file is passed to the code as a binary stream. In order to have the file downloaded to the user’s device we have to employ a trick. We create a link element (<a>) which is a download type link. Link elements with a download attribute download the contents of HTTP response to the user’s device rather than opening them in the browser. The Code above “clicks” the link element and then removes it from the page, which downloads the file.

Now we have a list of files attached to the current record in the formula field with a functioning download button for each!

Template of the Week

General Ledger Journal Entries

This General Ledger Journal Entries template demonstrates how you can enter both the Debit side and Credit side of a transaction entry, in a double-entry accounting system, with the single mouse click. This is also a good template to review if you want Ninox to create multiple records in a table when a single trigger is pulled.

Check it out in the Nioxus Member Portal today.

DocumentPLUS upgrade now available including Office 365 Integration and Team Collaboration

Learning Lab

Attention!

Unfortunately, this week’s Learning Lab is cancelled. But don’t fret! There will still be plenty of opportunities to learn, ask questions and earn gold stars in the future!

Our next Learning Lab will be on the 9th at 12:00pm ET or 6:00pm CET. See you there!

Check Out Our Templates

Did you know that Nioxus has built over 130 templates which are available to all Standard, Deluxe and Premier Nioxus members?

Nioxus University YouTube Channel

Nioxus has created nearly 100 videos and over 200 hours of content teaching you how to use and optimize Ninox, as well as our supplementary products, CalendarPLUS, ReportsPLUS and DocumentsPLUS!

Weekly Comic

CLICK IMAGE TO ENGLARGE

Top Technology Trends, Treasures and Triumphs

Please Release Me

Windows 11 Release Date is October 5, 2021…This is the first major operating system update in six years and the longest stretch between releases in the company’s history. It will be available as a free upgrade for existing Windows users who are eligible. But be aware that not every promised feature will be available when Windows 11 comes out this fall and it won’t be rolled out to every single compatible Windows device all at once.

Microsoft says that it will include an updated start menu, integrated Microsoft Teams, new multitasking tools, new widgets, as well as a streamlined, Mac-like design with rounded corners and app icons displayed in the center of the taskbar. New Sounds are designed to be less nerve-racking by making them less high pitched than they were in Windows 10.

One of the most anticipated updates, support for Android apps will not be included and they offer no date as to when it will be available. Android apps will be available, by way of Amazon’s Appstore. Microsoft most likely did this refresh due to the rising completion from Chromebooks running Google’s Chrome OS (Chromebooks can run Android apps).

According to Microsoft, the free upgrade to Windows 11 will be in phases and a measured process. So most likely new eligible devices will be offered the upgrade first and then they will roll it out to other in-market devices. This will most likely be based on a variety of factors such as hardware eligibility, reliability metrics, age of device, etc. Microsoft says that it expects all eligible devices to be offered the free Windows 11 upgrade by mid-2022.

The Windows Update app on your PC will inform you when and if your system is eligible for the upgrade. You can also go to Settings > Windows Update > Check updates to see if your device is ready for the new OC.

If your PC is not fully compatible with Windows 11, Microsoft is still supporting Windows 10 until October 14, 2025. Microsoft revealed a workaround for those who don’t meet the minimum system requirements for Windows 11 last week. You can install Windows 11 on any hardware using an ISO method, if the PC has a 64-bit 1GHz processor with two or more cores, 4GB of RAM, 64GB of storage, and a TPM 1.2 chip. But if you use the workaround, your PC will be in an unsupported state which means that those folks might not get access to Windows Updates and security patches.

If this release is successful, it could further secure the franchise’s future, which can also benefit other parts of Microsoft’s business, such as Azure and Office.

Sources:

Windows

The Verge

The Verge

Copyright 2021 © All Rights Reserved.

All logos, trademarks and names are the protected property of Nioxus Corporation or their respective owners.

“Ninox,” “Ninox Database” and the blue Ninox owl eye logo are the property of Ninox Berlin and are used with permission.

en_USEN