Jump to content

Record locking with related table


This topic is 3516 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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!

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This topic is 3516 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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