Importing linked data
We show you how linked data can be imported into related tables
When importing linked data to Ninox, the relation between tables will not be automatically imported via CSV file, but it needs to be built with a table link. Ninox builds table links solely based on the Ninox-own keys.
Suppose you link a table Invoices to another table Customers. Ninox creates in the background of the table Invoices a field for the No. of customer. When importing linked data we need to recreate this action so Ninox recognizes the relation and our tables remain linked.
Note, if you have previous experience with other databases: SQL, this would be equal roughly to ALTER TABLE “Invoices” ADD COLUMN “Customers” FOREIGN KEY REFERENCES customer (No).
To fill properly,
Invoices.Customerwhen importing this field, you need to give the Import Wizard information enabling Ninox to identify the right customer to build up the relation.
??? Example / Screenshot??? We have Nina Ninox to show examples.
The procedure to import relational data is illustrated by the example Invoices => customers. Customers is the main table and Invoices is the detail table because a customer can have multiple invoices.
- 1.Preparing the data to be imported
- 2.Creating the tables in Ninox
- 3.Import in the main table
- 4.Import into the detail table
The data must be in 2 CSV files with the following exemplary structure:
Customers.csv — customer No.; first name; surname
Invoices.csv — customer No.; invoice number; date; amount
It is important to have a common key field, which is in this case customer No. The other fields are for illustration only.
Create analogous to CSV files 2 tables in Ninox:
- Customer No (text)
- First name (text)
- Name (Text)
- Customer No (a reference to the Customer table, visible in the image below)
- Invoice number (text)
- Date (date)
- Amount (number)
Skipping this step means you are importing raw CSV files to your Ninox and that will not give a wanted result.
Note that the table Invoices doesn’t have a field for the customer number, instead a link to the Customers table.
3. Import into the main table
Import the Customers.csv without special settings into the Customer's table.
4. Import into the detail table
Import the Invoices.csv into the invoices table.
In the field assignment, you specify the following:
[Customer No] — [customer (Customer No.)] (Update All Fields)
Ninox tries to make an automatic match by comparing column names, and field types – but you can modify that manually.
Through this assignment, you tell the Import Wizards to look up customer No. from the Invoices.csv in the Customer table to associate the right customers
Here is the result of our import! In the last Customer column, we have a correct connection of the specific Customer to the related Invoice.
Congrats! You have imported your linked data from a CSV file to Ninox!