Use Master/Detail Without Foreign Key

Usually, VisionX creates master/detail relations with foreign keys directly in the database, e.g.,

This is the perfect use-case for a master/detail screen like this one:

Every project (1) has a list of tasks (2). This is the perfect scenario.

But if you have an existing database schema, it's also possible that the model is not in Satisfying 3NF. The model might look like this one:

The foreign key is missing in the database. But no worries, it's still no problem to create a screen with a master/detail relation as shown above. The best way would be to create a new empty screen (1):

Next, let's include the table objects. Start by creating a new table (2). The New Table Wizard will appear:

Please choose Use existing data from database tables (1).

and Use Application Database User (1). In the next step, choose the master table:

In our example the master table is Projects (1). Now we need the detail table as well. Repeat last four steps and create a new table for the Tasks table. The result should look like:

The data area contains the Projects table (1) and the Tasks table (2). Now we need to create a relation between the Projects and Tasks table. To achieve this:

edit the Tasks table (1) and show more (2) options. Next, enable database changes (1) and navigate to the Projects Id column (2). Press “Define Combobox” (3),

and use the existing Projects table (1):

Now we have a relation between Projects (ID) and Tasks (PROJECTS_ID). Be sure that you press “Finish”. No worries, the database won't be changed in this case.

As final step, we have to define the master table reference. Start the Edit Tasks Table Wizard once again and set the master table to Projects (1):

The data area for the Tasks table now has a different symbol (1), which means that the Tasks table has a master:

Now it's possible to use the tables as usual and the master/detail will work automatically.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information