BookmarkSubscribe
Choose Language Hide Translation Bar
DavidLeber
Community Trekker

Multi-User Access

I'm working on a solution which will live on a network drive, to be accessed by multiple users asynchronously. Specifically, I have several "database" tables that users will add rows to, where the rows then contain links to their full submitted datatable. 

 

Is there any built-in way to manage file access permissions in a situation like this? I want to avoid a situation where a user opens the "database" table and forgets to close it, locking everyone else out of the tool. I could code in my own variation on a mutex, but I don't want to reinvent the wheel if there is a built-in, easy solution. The ideal solution would be some sort of JSL script that sends a row of data to a data table without taking the lock on the data table.

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
David_Burnham
Super User

Re: Multi-User Access

Just to be clear, when you say "database" tables, you mean JMP tables?

 

I'm not aware of any ability to perform row locking - JMP is inherently single-user so I assume it doesn't have that ability.  This is what I do:

openSharedTable= Function({filePath},{default local},
	
	isLocked = 1;
	nAttempts = 200;
	delay = 0.1;
	attempts = 0;
	While(isLocked & attempts < nAttempts,
		attempts++;
		dt = open(filePath,Invisible);
		value = dt << Get Table Variable("Locked File");
		If (value=="",
			isLocked = 0
		,
			Close(dt,NoSave);
			Wait(delay);
		);
	);
	return(dt);
	
);
-Dave
1 REPLY 1
Highlighted
David_Burnham
Super User

Re: Multi-User Access

Just to be clear, when you say "database" tables, you mean JMP tables?

 

I'm not aware of any ability to perform row locking - JMP is inherently single-user so I assume it doesn't have that ability.  This is what I do:

openSharedTable= Function({filePath},{default local},
	
	isLocked = 1;
	nAttempts = 200;
	delay = 0.1;
	attempts = 0;
	While(isLocked & attempts < nAttempts,
		attempts++;
		dt = open(filePath,Invisible);
		value = dt << Get Table Variable("Locked File");
		If (value=="",
			isLocked = 0
		,
			Close(dt,NoSave);
			Wait(delay);
		);
	);
	return(dt);
	
);
-Dave