Support
One-on-One consulting and assistance based on your specific and unique needs
Media
Development tips from various members of our Nioxus team
Get the help you need from the experts at Nioxus. Contact Us >
Get the help you need from the experts at Nioxus. Contact Us >
Media
Keep up to date with Nioxus tips, tricks and products
Get the help you need from the experts at Nioxus. Contact Us >
Support
Receive discounts if you have a membership
Media
Learning about Nioxus and a few of our clients
Get the help you need from the experts at Nioxus. Contact Us >
This week we will look at how we can read out files from the file API and display their file names in a formula field in Ninox. It is possible to get the list of files for a record from a Ninox script with the files(record) function. However this will only be possible if you are in the same database as the file record whose file you would like to read. To get files from anywhere, you will need to use the API.
html("
hello
")
This script will display the files that are attached to a record in a formula field. The fetch() javascript function is used to send a GET request (which is the default method) to the api files endpoint. The function getFiles() is executed as soon as the html is rendered on the page by calling the function in the onload event trigger of an empty style element. Files that are being retrieved from other databases can be accessed by simply modifying the url that the request is sent to and the API key if necessary.
Next time we will take a look at how to download files to a user’s device using the API.