Filtering element can-read in the collection

Hi,

I have a collection that I would like different type of users to read different records (based on one of the fields in the record - just like a simple where in SQL).

I have actually two questions -

  1. how do I do the AND in the language (&& doesnt work). I suppose that the concatenating the where statements could do that, but it is not readable at all, is there any better way to do it?
  2. is there any other way to specify which records could be read by people (for instance user type A can read all the records with the status A, while the user type B can read only the records specified with B)

Example:

'Requests': collection ['Request ID'] {
	can-read: user .'Type'?'Admin' 
		|| where ( user .'Type'?'A' 
			where ( .'Status'?'Other' 
				where ( user is ( >'User' ) ) ) )

→ I suppose that here, either the Admin can read everything, or the user of type A, where the status is Other and where the currently assigned user to the task is him right?

@1: better formatting can help. I updated your code sample. I do not think && will make it more readable and I do not think there is currently a better way to do it. We’re open to suggestions for improvement.
@2: you can express ‘user type A can read all the records with the status A, while the user type B can read only the records specified with B’ as follows:

can-read:
    user .'Type'?'A' where ( .'Status'?'A' )
    user .'Type'?'B' where ( .'Status'?'B' )

About your final question: your explanation is correct!

I just noticed that your code sample is not valid Alan code. It should be:

'Requests': collection ['Request ID'] {
	can-read: user .'Type'?'Admin'
		|| user .'Type'?'A' 
			where ( .'Status'?'Other'
				where ( user is ( >'User' ) ) )