Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Using Tap Forms › How to enforce Referential integrity
Tagged: RI Referential integrity
- This topic has 4 replies, 2 voices, and was last updated 2 years, 4 months ago by Bernie McGuire.
-
AuthorPosts
-
August 6, 2022 at 11:36 AM #47725
Bernie McGuireParticipantIs there a way to prevent orphans from being created in a 1-M or M-M relationship in Tap Forms.
Here is the situation A company has Departments, Departments have employees, every employee must be in a department.
The Design !. Department Form, 2. Employee Form. The Department form has a ‘Line to Form’ pointing to Employee as 1 to Many, with show inverse relationship checked.
Work Flow that works: Open Department Form, Click + on Employee (link to form) and add an employee. This works fine.
Work flow as a problem: Operatore opens the Employee form list, Clicks + to add and a Employee form opens but NO department is assigned (obviously) and if the operator does not assign a department this will be an orphan employee (until some intervention is made to assign the Department)Is there a way to keep work flow 2 from happening. A way to force a department always be assigned to a new employee? I rather not do this after the fact, ie , with a script that checks for orphans etc.
Rather either prevent it or enforce it.
I rather not hide the employee form because it is useful to pull up the list of employees and go directly to that individual form.
Is it Possible?
ThanksAugust 6, 2022 at 11:39 PM #47732
BrendanKeymasterHi Bernie,
I have not added support for enforcing referential integrity.
Perhaps in a future version I will.
But it’s tricky. Should I prevent an employee from being created on its own without going through the Department’s Employees Link to Form field first? Whenever you create a new record, should I open a modal window with the record details so that you can’t switch to another record and you’re forced to fill in the Department field then before you can click a Save button?
Just some things to think about.
Thanks,
Brendan
August 7, 2022 at 12:24 PM #47746
Bernie McGuireParticipantBrenday
Yes its a classic delemia :) One possibility, which I think is similar to you first approach, would be to allow one to disble the ADD function on the Employee Form in this case, and force added to be don from the Department Form.What I have implemented as a tempoary solution, which doesnt solve the problem , but alerts to the issue, is scripting as follows.
On the Employee Form:
1. a hidden auto increment
2. the link from form for Departments field
3. a hidden script field that does the following:
It is triggered by a chane in the auto increment,
it checkes if the link from field for Department is = undefined, and if it is,
executes a Utils.alertWithMessage(“Warning”,”A an employee must have a departemnt so totals will be correct. Use the employee add from the Department Form”.This doesnt prevent the error but alerts the operator that additional stepes are necessary to fix the situation. It would be ideal if I could close the open Employee FOrm, deleteing the record to force the correct operation.
If there were some way to say, pop up a Department List and let the operator assign a Department. This might be the most user friendly solution. If possible of course.
Any time you want to knock around ideas Brendan, let me know, Im happy to engage.
Thanks for all you hard work.
Bernie- This reply was modified 2 years, 4 months ago by Bernie McGuire.
August 8, 2022 at 2:18 AM #47749
BrendanKeymasterI suppose having a “Disable Add Records for Link to Form” checkbox button (or something like that) on the Link to Form field setting might be a place to put that feature. In a dozen years though, you’re the first person who has asked for this feature.
August 9, 2022 at 1:12 PM #47765
Bernie McGuireParticipantBrandon,
Hi. Thanks for the information. Just from my experience I try to design a UI so the user will not ‘shoot him/her self in the foot’.I was just wondering if it were possible, I didn’t really want to add anything to your work queue.
It’s a great product at it stands. Keep up the good work.
-
AuthorPosts
You must be logged in to reply to this topic.