Jump to content
Server Maintenance This Week. ×

Preventing user collisions


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

Recommended Posts

I'm preparing an import routine which is pretty central to the DB solution I've built.  It'll be used many times by many people in a FM Server/Client environment.

The basis is that a user imports data to what's basically a temporary table, whereupon they can review the data prior to a full import to the main data table.

A script fires when the user hits 'Go' and performs the import to the main data table.  The final act of the 'Go' script is to delete all records on the temp table, leaving it clear for the next import.

I need to ensure that there can be only one set of data on the temp table at any one time and that this is being used by only the user who placed it there until the 'Go' script has run its course.

I have no idea how I might do this and I hope I've made the scenario clear!

Thanks in advance

Link to comment
Share on other sites

I can think of a few things to try. First, set a flag field. Make sure it NOT global. Befor the import script starts doing anything serious have it check the flag. If "on" exit script else set to on end if.   

The he second would be to not actually use a temp table. Rather collect the data into a global variable, format the data to display nicely, go to a layout set to display the global variable. When user confirms, import the data in the variable by looping through the records. 

The second method works well with SQL and would be the method I would use. But it is a more advanced method. 

Let me know what you decided to do

Link to comment
Share on other sites

Hi Nuos

Thanks for your help here.

I've pretty much got the import routine firing and displaying the way I need it to so whereas I can see how the second method would work well, it would probably cost more in time to undo and redo compared to the first method :)

So, to be clear, I set a field on the import temp table which is 'On' or 'Lock' or something like this.  I wrap my existing script in the If...End if; and then If flagfield="On" exit script else flagfield="On" EndIf.

I see how that would work yes, I need to get a couple of users to test it.

Thanks very much!

 

Link to comment
Share on other sites

Ya thats about right.  Just make sure you set the flag to off at the end of the script.  Also, make sure the user is on the same field that the flag is set on - as it is not global (and cannot be).  Make sure when you check the flag that that user is taken to the right layout and the right record.  Let me know how it works ...

Link to comment
Share on other sites

I need to ensure that there can be only one set of data on the temp table at any one time and that this is being used by only the user who placed it there until the 'Go' script has run its course.

IMHO, a better approach would be to let all users use the table at all times - but let them have access only to their own records.

Edited by comment
  • Like 1
Link to comment
Share on other sites

One thing to consider, Stu, is whether you really need a separate "temporary" table in order isolate your newly imported records for final inspection before moving them into their final table.

When you perform an import routine, FileMaker automatically isolates the new records in a discrete found set. If inspection of the data reveals problems, or the dialog reporting how many records were imported, skipped, etc. raises concerns that things didn't go right, you've got several options at your disposal while that found set is still isolated. You could edit individual records, you could make global changes with Replace Field Contents — often a dangerous action, due to its sledge-hammer demeanor and lack of "Undo," but this is one scenario where RFC might make sense — or you can delete the entire found set and try again (presumably after correcting the underlying problem). For even further isolation of the imported records, you can open a new window before performing the import, and carefully control what users can do in that new window.

No temporary table to clear out . . . and no user collisions.

Just a thought.

Mark

Link to comment
Share on other sites

Some interesting approaches to a solution, thanks for all your help so far everybody.

IMHO, a better approach would be to let all users use the table at all times - but let them have access only to their own records.

​Comment, I wasn't aware you could do this - or perhaps I already am but just don't know it!  If I understand correctly, one table exists with say, three user's imported data sets on it.

How do I ensure that user A has access to only his records and that he doesn't interfere with user B or C?

Hadn't thought of something like this, please forgive any apparent dumb questions!

Link to comment
Share on other sites

How do I ensure that user A has access to only his records and that he doesn't interfere with user B or C?

First, you must associate each record with the user that created it. You do this by having a text field that auto-enters Creation [Account Name].

Then restrict user privileges for this table's records to only view records when:

CreatedBy = Get(AccountName)

 

Link to comment
Share on other sites

This topic is 3241 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.