As you may know by now, Lotus Domino Designer works with a non-relational database. This causes issues when you want to embedded a view into a form and reference records that relate to the current document.
The solution is fairly simple but not always easy to find. You can create an embedded view that uses the "@UNIQUEID" field of a document to show only related records.
In this post I will describe the process of creating an appropriate view and embedding it in a form so it only shows related records.
For this example, I will have a form for customers and a view that shows all calls that were made to that customer. A more detailed explanation can be found here:
Create two forms:
1 - A customer form with relevant details. Insert an embedded view, Create -> Embedded Element -> View... and select the view you want to add, or leave a place for it to be entered later. Add a hidden text field at the bottom of the form (position not essential, just a personal preference). In this example it is labelled "customer_id". In the properties set to Computed and add "@Text(@DocumentUniqueID)" in the Value section.
2 - A calls form with relevant details. Design this to look like a popup window, on mine I set the form background colour to grey and inserted a table with white background that held all of the fields. Enter all necessary fields, add a save & close button (see here for formula: https://www.ibm.com/developerworks/mydeveloperworks/blogs/steveheadDomino/entry/useful_field_types_and_their_properties9?lang=en). Add a hidden text field to hold the document id, make it Computed and enter into the Value section "@ThisValue". In this example it is labelled "call_customer_id".
Create a view with the second form as it select statement, e.g. "SELECT FORM = "call details form"". Make the first column the id from the second form, e.g. "call_customer_id". Go into the "Sorting" tab of the column properties. Set Type: Categorized, sorting in optional.
In the original form go to or add an embedded view. Give it an appropriate name.
In the Objects pane, bottom section of the screen, click on "Show single category" and enter the field name on the current form that relates to the categorized view column, e.g. "customer_id" (without quotes).