Explore printing, table relations and composition, roles and rights management, triggers, and connecting to Integromat
In this section, we focus on unexplored features and leveraging your new skills to get the most out of Ninox.
The topics include:
View tables as either a PDF or as a web page (HTML format) for printing.
To print a table:
- 1.Start by navigating to a table.
- 2.Click the Actions gear icon.
- 3.In the drop-down menu, select Print View.
- 4.By default, the table will display as a PDF format directly on your screen or your browser will download the PDF as shown below.
In addition to PDF format, Ninox supports displaying a table as a web page (HTML format) which can then be printed. You can also change the text size used.
To change print options:
- 1.Navigate to the Tables screen.
- 2.Click the red Admin wrench icon in the upper-right corner to enter admin mode.
- 3.Next, select the Options tab. A window appears.
- 4.Select Printing Tables…
- 5.In the Font size field, change the value to make your text larger or smaller, as needed.
- 6.In the Preview as field, you can change from the default PDF format to HTML, which displays a table directly in your web browser.
After changing the printing option to HTML, you can proceed to viewing the table on a web page and then printing it.
Next, right-click on the web page and select Print… This process may differ based on your browser and/or operating system—Windows 10 using Chrome is shown below.
In addition to printing tables, you can also print one or more individual records. To print records, click the Print icon when viewing a table.
The first step is to look at how to select records. There is a slight difference between an active record row and a selected record row:
Why is this important? Ninox uses your selections to present printing options for you. Let’s do a quick print, then look at our options in more detail.
Start by making one row active—select a row and it turns blue—and then click the Print icon:
After doing this, the Print screen appears. In the upper-right corner, click the Print icon and then—in the drop-down menu—select either This record or All (x).
Selecting This record prints only the active record—Ninox prepares a PDF and your browser will automatically initiate the download process.
Selecting All (x) prints all records—as above, Ninox prepares a PDF for download.
Let’s try a different way. This time, make 1 row active (“Bioderm Ltd” in the graphic) and choose 3 different rows (“Allstar Sports,” “Otis Manufacturing,” and “Radargus” in the graphic) by selecting row numbers.
Next, click the Print icon:
The Print screen appears. In the upper-right corner, click the Print icon and then—in the drop-down menu—select either This record or All (x).
Selecting This record prints only the active record (“Bioderm”), regardless of whether it was selected or not.
Selecting All (x) prints all selected records (“Allstar Sports,” et al).
- To print all records, make one row active then select All; alternatively, you can select every single record in the table.
- To print selected records, select them by clicking the row numbers, then select All (x).
- To print an active record, make the row active, then select This record.
When printing, you can select paper format and margin values to customize your printouts—note that all measurements are in millimeters. In addition, the document width and height fields are auto-populated based on the paper format selection.
As we discussed in the last Intermediate tutorial, tables can be referenced with each other to create more ways to integrate information.
In the example that we worked on, we created a reference from the Events table to the Company table. This enabled us to select a company that was associated with an event—each event could only be associated with one company, but each company could be associated with multiple events.
As a reminder, here’s the Events form. Notice the Company field at the bottom—one company is associated with one event:
…and here’s the Company form. Note that two events are associated with one company:
In this example, a company can sponsor many events, but an event can only have one company sponsor at a time.
This type of table relationship is called a “1:N relation,” which means that one data record from one table is assigned (related) to many data records from another table.
From the Tables screen, select Data Model to get a visualization of this relationship—make sure that your red Admin wrench is selected.
Here’s what it looks like for the Events and Company tables mentioned above:
In this relationship, the Events table is a “child” of the “parent” Company table.
In a 1:N relation like this, there is no cause-and-effect between the tables. Deleting a record in one table has no effect on records in the other table. The two tables simply share data between each other.
In some scenarios, though, you may want to create a cause-and-effect relationship.
For example, if a table populated with telephone numbers is referenced to a table with contact details, then we could create a deeper cause-and-effect relationship between them: when a contact record is deleted, then the associated telephone numbers in the other table would be deleted as well (since the numbers no longer have a purpose on their own).
This type of cause-and-effect relationship between tables is called Composition.
Ninox’s composition feature empowers companies to build robust datasets that can reflect accurate, real-time information.
But let’s not get too far ahead! First, let’s do a step-by-step walkthrough to see how the composition process works.
Using the knowledge you picked up in the intermediate tutorial, create two tables called Telephone Numbers and Contacts. The former is a simple 1-column table comprised of just telephone numbers. The latter is also a simple table with first name, last name, and maybe some basic company details.
Here’s a look at our new Telephone Numbers table:
We format the Telephone default value field to “+1” and also limit the number of characters to 12 (+1 plus 10 digits). Here’s what it looks like:
…and here’s a look at the new Contacts table:
Start by creating a table reference from the Telephone Numbers table to the Contacts table. Do not save yet!
At this stage, we have created a 1:N relation between both tables.
To turn on the composition feature:
- 1.Select the newly dragged-and-dropped Contacts field.
- 2.In the Composition field, select Yes.
- 3.Click the OK button.
- 4.Click the Save changes button to confirm.
A peek at the new data model shows a distinctly different visualization:
In this composition relationship, the Contacts table is now a super-table with the sub-table Telephone Numbers fully integrated within it.
Due to this new composition relationship, when a record in a super-table Contacts is deleted, then any associated records in the sub-table Telephone Numbers are also deleted.
Let’s see this in action.
First, we will open the Telephone Numbers sub-table and assign two numbers to the contact, Mr. George Sanderson:
If you need a reminder on how to do this, here is a visualization:
Next, we’ll have a look at the contact record for Mr. George Sanderson in the Contacts super-table. Notice that the two numbers are listed at the bottom:
Since there is a composition relationship, when we delete Mr. George Sanderson from the Contacts super-table, then the two associated telephone number records will also be deleted:
A composition relationship between tables is best used when sub-table records (e.g., telephone numbers) are closely tied to a super-table record (e.g., a contact) and their deletion will not adversely affect any other data.
Another example is an invoice item—such as a client-specific ID number—that is directly tied to an invoice. If an invoice record is deleted, then the invoice item will be deleted as well.
Ninox enables companies to exercise a great degree of control over how users can interact and use the solution. This is supported by a robust user management system that allows Admins to control access for team members as well as granular access over tables and even fields!
Ninox offers two default types of roles:
- Admin: Can create new databases, change the data model, and manage users
- Editor: Can edit and delete databases
When you create a new team, you are automatically the Admin of that team. Remember in the Explore tutorial we talked about how to invite other users to your team? During that process, you, as the Admin, can define what role the invited user will have.
Here’s a reminder:
By default, Ninox offers Admin and Editor roles, but you can also create your own role—these customized roles are used when specifying access to tables and fields.
To start, let’s explore how to assign rights at the table and field levels.
Ninox enables Admins to implement high-level permissions as well as more detailed granularity when it comes to granting rights to both tables and fields.
For tables, Admins can assign rights to user roles for all tables as well as specific tables.
Let’s demonstrate this process by creating a new role for a new user and then applying rights to that role.
To create a new role for a new user:
- 1.First, invite the new user by selecting Invite from the Database screen.
- 2.Select Create new role.
- 3.In the Role name field, enter a name for the new role. In this example, we use “QA Analyst.”
- 4.Click the OK button.
- 5.Click the Send invitation button.
The invitee receives an invitation via email containing a link. When they click the link, Ninox prompts to formally accept the invitation:
To assign rights on a larger scale across all tables:
- 1.From the Team Workspace screen, select a database. The Tables screen appears.
- 2.Click the red Admin wrench icon in the top-right corner.
- 3.Select the Security tab.
In this panel you can choose which roles have access to specific rights by selecting a drop-down arrow and then choosing 1 or more roles. By default, rights are assigned to all users (“everyone”) when no choices are made.
When done, click the Save changes button, then the OK button to confirm.
You also have the option of assigning rights to roles for individual tables.
To manage rights for individual tables:
- 1.Navigate to a table.
- 2.Ensure that the red Admin wrench icon is enabled in the top-right corner.
- 3.Click the Actions gear icon and, in the sub-menu, select Edit fields…
- 4.In the table panel, modify rights drop-down menus as needed.
- 5.By default, if no role if selected, then all users have access to the right.
Rights options available include the following:
- Allowed to read: Selected roles can view/read table records
- Allowed to write: Selected roles can change/write table records
- Create new Records: Selected roles can create new records
- Delete Records: Selected roles can delete records
- Readable if and Writable if: Admin can enter code that enables user-based conditions for reading/writing tables (not covered in this tutorial)
At the highest level of granularity, you can specify rights at the field/attribute level.
To specify rights for fields:
- 1.In the Fields panel, double-click/select a field. The Field Detail panel appears.
- 2.Select More options.
- 3.In the Allowed to read field, select one or more roles to enable field read access.
- 4.In the Allowed to write field, select one or more roles to enable field write access.
- 5.Click the OK button.
Triggers are powerful tools that introduce a level of automation in Ninox tables and fields. A trigger is another way of saying, “When x happens, do y.” or “When this happens, do that.”
Triggers can be used in various ways, for example:
- Copying values between tables
- Automatically changing values when something happens
- Automatically retrieving data from a linked table
If you are designing your own app, it's helpful to rely on a formula whenever possible. Sometimes using triggers can be a better option, for example if you need to create new records or pull data from a linked table.
Ninox triggers are implemented in two places: at the table level and at the field level.
In this tutorial, we look only at table-level triggers and how they can be used to introduce automated record updates.
A table-level trigger launches a specific code set either when a record is created (Trigger on create) or when Ninox updates a parent record and it will affect a child record (Trigger after update).
Let’s do a walkthrough of how a trigger can be used to automatically update an invoice number whenever a new record is created.
Imagine that we have a table that consists of invoices where every new record is a new invoice. Instead of manually typing in the next relevant invoice number, we can use a trigger to tell Ninox to automatically assign an invoice number for us.
Start by creating a simple table called Invoices with a Number field called Invoice Number. It should look like this:
Edit the table (i.e., click the Actions gear icon and then select Edit fields…) and, in the Edit Table screen, select the Trigger on create field.
The Code Entry screen appears.
The field Trigger on create is where we define a trigger. The trigger is activated whenever a new record is created in the table.
The Code Entry screen is used to enter Ninox code that can trigger events. In this case, we will enter a code that automatically increases the Invoice Number field by 1 whenever a new record is made (based on the number of the last record).
Enter the code below into the white content panel of the Code Entry screen:
Use the following to copy & paste:
let i := number(last((select Invoice).’Invoice Number’));
‘Invoice Number’ := i + 1
In line 1, we define the variable “i” by finding the last record within the field Invoice Number from the table Invoice.
In line 2, we tell Ninox that the number field Invoice Number should equal our variable “i” plus 1.
Finish by clicking the OK button. The OK button works if the code is accurate/valid. If the code is not accurate or not valid, a warning message appears specifying the part of the code that doesn't work.
In the Edit Table screen, click the Save changes button.
In the animated graphic below, every time the + icon is clicked to add new record, the value in the Invoice Number field increments by 1:
For visual assistance when starting with Invoice Number ”1800:”
This method increments the last-entered invoice record. It does not auto-increment based on the most recent invoice record, i.e., the invoice with the highest invoice number.
This could cause a problem when an old invoice is edited and its number changes to the most recent invoice number. When a new record is created, its number is based on the last entered record and not the most recent record, i.e., the one that was edited.
For visual assistance of the potential issue, refer to the graphic below:
In the graphic above, the most recent invoice is number 24 (row 3), but when we add new records, the trigger tells Ninox to increment based on the last entered invoice, which is number 5 (row 5).
Instead of looking at the “last” record:
let i := number(last((select Invoice).’Invoice Number’));
We look at the “max” record—the record number that is the maximum, or has the highest, number:
let i := number(max((select Invoice).’Invoice Number’))
Replace the phrase “last” with the phrase “max.” Here’s what it looks like in the code editor:
With this new code in place, let’s see what happens when we add a new record:
Ninox now looks at all Invoice Number data, determines which one has the highest value (most recent), and then auto-increments new records based on that number.
The Trigger after update feature has a specific purpose: it is used in a child table and is designed to update records after Ninox updates a parent record.
With the help of API, Ninox can integrate with a number of robust software solutions. One of these is Integromat, an online automation platform that enables users to connect multiple applications and substitute manual processes with automated workflows.
If you use Integromat, you can connect Ninox to monitor, list, retrieve, lookup, create, update, or delete records and files in Integromat as well as list teams, databases, and tables in your Ninox account.
From the team workspace, click the Actions gear icon.
Select Integrations... from the drop-down menu. Next, in the Integrations... window, click the Generate button.
After clicking the Generate button, an API key appears. Copy the character string to your clipboard.
To set up the connection:
- 1.Open Integromat. In the Dashboard, select Create a new scenario.
- 2.In the Integration screen, select Ninox and then click the Continue button.
- 3.Select the question mark icon, select Ninox, and then select Get Record. The Ninox dialog box will appear. Click the Add button.
- 4.The Create a connection window appears.
- 5.In the Connection name field, enter a unique name for the Integromat/Ninox connection.
- 6.In the API Key field, paste the API key from your clipboard.
- 7.In the Private Cloud URL field, enter your Ninox Private Cloud URL (if you are hosting).
- 8.Click the Continue button.
To specify Ninox data:
- 1.Select your Ninox Team, Database, and Table.
- 2.Click the OK button.
Ninox and Integromat are now connected. You can use Integromat to automate many of your favorite Ninox features, such as:
You’ve not only just connected Ninox with Integromat, but you have completed the independent tutorial as well.