Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I've created a layout as a list view, specifying a single field to display which is a name field from a table.

 

The issue is that, based on the permission level of the user, the list varies.

 

I have three permission levels - System Admin, Office Admin and User. When an Office Admin logs in, the list shows all records from the same office location as the Office Admin (read from a table using ExecuteSQL and Get(AccountName) as identifier). So far I've successfully got the account name and permission set of the user, and based on that it's straightforward to use ExecuteSQL to get a valid dataset, but what I'm trying to suss out is how to display that data into the list view.

 

It doesn't have to be a list view, I simply generated that to start working on the script.

 

What I'd also like to be able to do is to click on any item then produced and pass that selection to a query which displays all the data for the selected item. Is this possible? I know pasing variables into a script is, but not sure if items in a list can be clicked on and given individual events.

 

Any help or advice would be gratefully received.

 

Thanks

 

Martin

Posted

What do you have at the moment? A list in text form, as the result of an ExecuteSQL query? Or a found set of FileMaker records?

Posted

I created the list view, and as part of the create process, selected a table, and one field of text from that table to display. That generated the report with a single entry (from my table).

I'll add to the table to give me more data, but i need to understand the logic. And like i said, if I need to start with a different layout/report, that's fine.

Thanks

Martin

Posted

If (“big If”) I understand you correctly …

 

After you've queried the location data for the logged in Admin, you can go to your list layout and perform a Find for data with this location to display the results in your list. (Don't forget error trapping, unless your business rules ensure that there will records.)

 

If you create a form layout based on the same TO, you can simply switch between the list and the form (same TO, same found set), e.g. by using the name field in the list layout as a button that switches to the form for the same record, and a List button on the form. 

 

Is that how you want it to work?

Posted

Martin, not sure from your posts if you have set up record-level security. I mention this because if you have stored the account name in a field on each record, and then in Security, limited the records a user can see to, e.g., createdBy = Get(AccountName) -- then whenever you go to your list view and do a Find, the records returned will automatically be filtered for that user.

 

By List View, I mean a found set of records displayed in list (vs. form or table) view.

NOT a single text field with a list of names or whatever -- which is the result of an ExecuteSQL calculation.

Posted

Thanks, and whilst your replies are appreciated, think I may need to understand the application more to understand what you are talking about!

 

Let me explain in a bit more detail what is happening.

 

The application is a staorage for client data. There are three different user types, and each user type is able to see different cuts of the data, i.e.

 

System Admin - all data

Office Admin - all data for which their location is the location of the lead office data field

User - only data to which they are associated with by being a team member

 

I have added three sample records, and when switching to my list view layout (called CleintSelection), i see the three schee names I have added. I created the layout and specified a script to run OnLayoutEnter called SelectClients. The idea behind this was to perform a script to get the relevant account priviledge set, and, for the moment, for office admin, get the location of the current user from one of the tables. Once I know the user's location, I can then write the query to display data for the office admin user. I've attached screensshots of the scripts for more info.

 

I guess where i'm struggling is understanding how the list view I created can be modified to show different data, i.e. is the selection criteria I chose when I created the list view stored/editable?

 

Does that make sense?

 

Thanks again

 

Martin

post-109525-0-97926600-1380710267_thumb.

post-109525-0-35467400-1380710281_thumb.

Posted

ExecuteSQL returns a block of text, containing a list of fields or other stuff, optionally sorted. How you display that text is a separate matter. What I think you're not getting is that ExecuteSQL has no effect on the current found set, the sort order of the found set, or what fields are displayed on the layout.

 

I recommend you set ExecuteSQL aside for a minute and just script a Find, e.g.:

If( Get ( AccountPrivilegeSetName ) = "System Admin" )
  Show all records
Else
  Enter Find Mode
  If( Get ( AccountPrivilegeSetName ) = "Office Admin" )
     Set Field( location ; $you'd need to set this variable before you go into find mode )
  Else
     Set Field( user ; Get ( AccountName ) )
  End If
  Perform Find
End If

But as I alluded to in my previous post, this is not real security. I recommend you read up on record-level security, which will simplify your scripting and properly lock things down.

Posted

Thanks again.

 

I re-read your previous post, and to answer your question, no I don't store any user data for each client added, but that does make sense.

 

I've now added an extra field, CreatedBy, which is set as Creation Account Name, and using your script above as a starting point i'm now getting the correct data into the screen for the full access and office admin users, the only complication for users is that I havent yet created the link between clients and client teams, but I'm heading in the right direction, so thanks.

 

Thanks again

 

Martin

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