[Forms and FKs] Servoy restricts form relations to PKs?

Solving my relations problem here:

http://www.servoy.com/forum/viewtopic.php?f=2&t=11719

lead me to this question:

Why does Servoy prevent me from linking tabs to foreign keys relations?

Why does it show only the primary key relations in the relations window?

I had to reverse the linking process to be able to link a form based on a table primary key to another form based on one of it’s foreign keys.

Bob,

Servoy will use a relation to fill the data in the related tab form.
So when the main table is based on employees the related frm_employee_expenses tab form will be filled using the “employee_to_expenses” relation.
When you change the table for the main table, you broke this relation.

How is Servoy to know which data to put in the frm_employee_expenses tab if you do not put a employee data in the main form but courses data?

Rob

Hi Rob,

I know it looks really really weird but, well, it works…

Here’s what I get:

foundset of course_ids
=> select a course_id
=> (courses_to_expenses)
=> foundset of expense_ids
=> select an expense_id
// contains an employee_id as a foreign key
[SERVOY LINKING WARP FIELD]
=> (employees_to_expenses)
=> foundset of expense_ids
// limited to that particular employee_id
// which is EXACTLY what I want

I just had to tell Servoy to load a null foundset onShow of
the editing and list forms of employee_expenses
to clean things up if no employee_id has been properly loaded:

if (globals.curEmployeeID == '')
{
	controller.loadRecords(null);
	controller.relookup();
}

If you have a solution that doesn’t:

  • take advantage of the “Servoy Linking Warp Field”
  • break any linking rules
    I’m listening.