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.

Record locking with related table

Featured Replies

Hi There,

Hoping someone can explain what is happening.

On my home layout, I have a table linked which has a calculated field called "Current_Logged_User". It basically populates who is logged in using Get ( AccountName ). There's another calculated field called "CurrentWeek" that calculates the current week number using WeekOfYear ( Get ( CurrentDate ) ). Both fields are unstored.

I use those fields to create a relationship to another table for KPI purposes. I further have a popover on the home layout which when opened runs a script that checks if there's a record in the table for that account with a matching weeknumber. If not, it creates the record. The idea is that staff will then be able to enter their weekly KPI's quickly with only their current week visible. I provide a different layout where they can review past weeks.

 

Everything works fine except for the data entry. For some reason, trying to enter data using two different accounts on different computers results in the records being locked and throws an error. This should not happen though, each account  has a different name.

If I open a layout for my KPI table and look at all the records, I can edit each record just fine (except for the record that is currently being edited on one of the machines, which makes sense). However, when working via the relationship, for some reason, FM thinks that each user is editing the same record (even though they're not, same named fields have different values for each user).

 

I may have been developing too much today, but I'm just not seeing it.

 

Thanks for any pointers!

 

However, when working via the relationship, for some reason, FM thinks that each user is editing the same record (even though they're not

 

If I understand your description correctly (which is not at all certain*), they are editing the same parent record.

 

--

(*) It would be much easier if you named your tables.

  • Author

Hi Comment,

The parent table is called "Preferences", the child table is called "KPIScoreCard". I link the two by creating a relation between Preferences::Current_Logged_User with KPIScoreCard::LogonName, and Preferences::CurrentWeek with KPIScoreCard::WeekNr.

 

My home page layout is linked to Preferences.

The script moves to a layout that is linked with KPIScoreCard, creates a new record, sets the correct fields for the realtionship and moves back to the originating layout.

 

The fields on the popover (on the Home layout linked to Preferences) are all from KPIScoreCard.

The way I see it, with the relationship I move the record depending on the user logged on and should not be getting these record locks?

 

THanks!

But how many records are there in the Preferences table?

  • Author

Clonk. That quarter just locked in. I see what you mean. There's only one record. Huh. I guess I'll have to reread the way relationships work in FM.

Thanks!

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.