~~NOTRANS~~ ~~Title: Use Master/Detail Without Foreign Key ~~ Usually, VisionX creates master/detail relations with foreign keys directly in the database, e.g., {{:visionx:masterdetail_fk.png?nolink|}} This is the perfect use-case for a master/detail screen like this one: {{:visionx:masterdetail_screen.png?nolink|}} 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 [[https://en.wikipedia.org/wiki/Database_normalization|Satisfying 3NF]]. The model might look like this one: {{:visionx:masterdetail_nofk.png?nolink|}} 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): {{:visionx:masterdetail_newempty.png?nolink|}} Next, let's include the table objects. Start by creating a new table (2). The New Table Wizard will appear: {{:visionx:masterdetail_newtable.png?nolink|}} Please choose **Use existing data from database tables** (1). {{:visionx:masterdetail_newtable_appuser.png?nolink|}} and **Use Application Database User** (1). In the next step, choose the master table: {{:visionx:masterdetail_projects.png?nolink|}} 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: {{:visionx:masterdetail_tables.png?nolink|}} 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: {{:visionx:masterdetail_edit_tasks.png?nolink|}} 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), {{:visionx:masterdetail_edit_tasks_dbchanges.png?nolink|}} and use the existing Projects table (1): {{:visionx:masterdetail_edit_tasks_projects.png?nolink|}} 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): {{:visionx:masterdetail_tasks_master.png?nolink|}} The data area for the Tasks table now has a different symbol (1), which means that the Tasks table has a master: {{:visionx:masterdetail_tasks_icon.png?nolink|}} Now it's possible to use the tables as usual and the master/detail will work automatically.