VOLUME XCII 08/04/2021
This Article will be part of a series of articles which will explain how to use the Ninox API to work with files that are attached to records in Ninox.
Place the following code in a formula function in Ninox:
The code above creates a form with a file selector button. When a file is selected , the function “uploadFile()” sends the file to the Ninox API. The function is called in the onchange function for the input element, so the upload will occur as soon as the file is selected. The code will attach the file to the current record.
Note that we have used the global function apiKey() to access the API key here for security. You will have to replace this with your own API key if you use it in your database.
The body of the HTTP request being sent to Ninox needs to be in a particular format when sending files. The above code uses the browser’s built in FormData() object to make sure that the call is made in the correct way. When a FormData object is passed into the body of a fetch() request, a few headers are added to the request which are necessary for the form to be sent correctly.
In this case it is just as easy to go to the attachments and upload the file there. This method will work well when you would like a central location from which you would like to upload files, or you would like to create a custom file upload button. Next time we will look at more applications of the files API.
Join us this Thursday at 12:00pm ET or 6:00pm CET where we’ll be doing an open Q&A! Be sure to bring your questions for us! And don’t forget, asking questions will earn you Gold Stars!
Gold stars can be redeemed at the end of the year for prizes, so try and earn as many stars as you can! For more information about the Gold Star Program, click here.
Did you know that Nioxus has built over 130 templates which are available to all Standard, Deluxe and Premier Nioxus members?
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!
The world’s thinnest magnet that operates at room temperature could advance new applications in computing and electronics. This one atom thin 2D magnet was recently reported in the journal, Nature Communications and was developed by the Lawrence Berkeley National Laboratory and UC Berkeley. According to senior author Jie Yao, a faculty scientist in Berkeley Lab’s Materials Sciences Division and Associate Professor of Materials Science and Engineering at UC Berkeley, “We are the first to make a room-temperature 2D, magnet that is chemically stable under ambient conditions.” Yao goes on to say, “It opens up every single atom for examination, which may reveal how quantum physics governs each single magnetic atom and the interactions between them.”This design was created by using a technique that the team says is easily expandable and features a single atomic layer of zinc oxide, with occasional cobalt atoms interspersed within it. The free electrons of zinc oxide maintain the magnetism of cobalt while using the basic mechanism that is different from all other attempts to create 2D magnets. “With our material, there are no major obstacles for industry to adopt our solution-based method”, says Yao. “It’s potentially scalable for mass production at lower costs.”“Our results are even better than what we expected, which is really exciting. Most of the time in science, experiments can be very challenging,” Yao said. “But when you finally realize something new, it’s always very fulfilling”
All of you keep your eyes out for new tools for the study of quantum physics as well as high-density, compact spintronic memory devices. We are all on the precipice of some extremely exciting technology in the upcoming months and years.
Journal reference: Nature
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.