Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Change 'Child' record when changing 'Parent' record?

Featured Replies

Hope you're all having a great day. I have a Table of families and a related Table of children, related by ID. On occasions, we need to change the ID of the whole family as they move from 'inactive' to 'Active'. Obviously chnaging the ID of the family leaves the children wondering on their own unrelated to that family and I then ned to go in, search for the children and chnage their ID's as well to get them back with their surname and parents.

How can I automate this that I just change the family ID and both the Children's ID's chnage at the same time?

Thanks so much - I really appreciate it.

On occasions, we need to change the ID of the whole family as they move from 'inactive' to 'Active'.

Why would changing the status of a family necessitate changing its ID?

---

Hint: this is a rhetorical question; it shouldn't. An ID should be meaningless and not depend on any attribute of the object.

  • Author

Yes, totally right. Changing the status doesn't affect the ID at all.

This is a database of children registered at an academy. Each family as a unique ID starting from 001, 002 etc, but we often get people interested or who come for trial lessons. We register their family information under the ID of 999, 998 etc. Soem join and others don't, so when they decide to join, we want that family to slot in in the next unique ID. Thus, we would like to change the family ID whilst chnaging the Student ID automatically.

Any easy way to do it?

Thanks so much and have a great weekend.

The easy way to do it is not to. The way you have it now, your ID is not meaningless.

Yes, totally right. Changing the status doesn't affect the ID at all.

This is a database of children registered at an academy. Each family as a unique ID starting from 001, 002 etc, but we often get people interested or who come for trial lessons. We register their family information under the ID of 999, 998 etc. Soem join and others don't, so when they decide to join, we want that family to slot in in the next unique ID.

So changing a family's status doesn't change the ID, but changing a family's status from not-joined to joined changes the ID? Don't do that. For one thing, changing IDs for foreign keys in related tables is cumbersome to maintain. For another, you'll eventually get ID collision when the IDs for families that have joined catch up to families that have not joined. If it's important to your organization that IDs only be sequentially assigned to families that have joined, here's how I would approach it:

  1. Push back against the need to assign sequential IDs to only families that have joined. If that doesn't work...
  2. Use two separate ID fields for families, one that the database uses to relate family records to records in other tables (children) "under the hood" (this should not be available in the user interface), and another that users will see as the visible ID in the interface that's only set by script when a family joins. The "under the hood" ID is the actual primary key for the table, and it should never be changed. The user-visible ID should only be set when a family joins, and should never change again after that.
  3. Create a new table that only has an ID field set to auto-enter a sequential serial number. This is where you'll make family IDs.
  4. In the script you use to update a family from "not-joined" to "joined," include a section or subscript that goes to a layout based on the new table, creates a new record, saves the ID to a $variable, deletes the record, returns to the family record, and sets the user-visible family ID to the value in the $variable.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.