Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

simple 'show records by user' script

Featured Replies

i'm new to this and this is probably something that everyone here already does all the time....

i want users to see only the records that they have entered into the db. i'm not sure how to do this, but i've been trying to do it by creating a user field that calculates (get(accountname)) for each record.

then, i've tried to create a script that upon login performs a Find on all records with that username. I have not had any luck figuring out how to do that though, and I'm guessing there must be a better, simpler, more standard way to do this.

  • Author

I think what I'm about to ask is something so simple everyone here already does it, but I'm asking anyway.

I simply want to display only the records (for viewing or editing) that are specific to the user that made them. So, I've put a 'user' field into my tables that is calculated by (GET(account_name)). Then I was thinking that I could create a script that would occur after login that did a Find on those records whose user=thecurrentuser. I don't know if that's the right way to go about it, and if it is, I still haven't figured out how to make the Find part of that script do what its supposed to--its stuck searching for the same user (rather than current user) each time.

Would love some hints....

Two things need to be done: records needs to have a field which identifies the user that created the record -- a text field that auto-enters the creator account name.

Then the file needs to have an account and privileges set up so that the user can only view the record if the record creator matches the current account.

  • Author

hi, thanks for your reply.

in my initial post i mention that i did set up a field that auto-enters the user's account name. then i also mentioned that i need to figure out how to set it up so only that user's records show. i'm asking HOW do i do the latter. I've gone into accounts/priv but I don't see how to do this since it seems to filter access by table and layout, not by record.

Guiseppe Pupita have made a template dealing with these matters, I do not agree with the method, since it can be circumvented, by turning the debugger on!

http://www.buliga.it/TipFiles/Gateway7EN.zip

Instead would I explore if it weren't posible to give each user his own table, which then is 1-to-1 related to the common datatable, so each users table only holds one field the relational keyfield, browsing thru records is then done from that perspective.

--sd

  • Author

hi, that's an interesting idea to make different tables for different users. if i want to summarize data across users, might that complicate matters? or no?

No not particularly - just use GetSummary( and the summaryfield in both paramters in the command, the summary field needs then to be in the common table.

There can be some refreshing issues you might solve with this:

http://www.briandunning.com/cf/390

...not that I've in any way have tried any of this yet, I just brainstormed here...!

--sd

Guiseppe Pupita have made a template dealing with these matters, I do not agree with the method, since it can be circumvented, by turning the debugger on!

Then why bother with it, when there is a simple method that meets the requirement, as mentioned by Vaughan.

I've gone into accounts/priv but I don't see how to do this

Create a privilege set for users. In this set, choose 'Custom privileges' for Records. For each relevant table, define the View privileges (at least) as limited, and enter the condition:

Get ( AccountName ) = AccountName

where AccountName is the field that auto-enters the account name.

See also:

http://www.fmforums.com/forum/showtopic.php?tid/181085/

Hi Blissland,

Could you show your Find' script?

Actually, the way to go about this is by using record level access privileges.

Hi Bcooney,

I saw this thread on another his similar thread. I am not sure if this thread has any connection with another one. So I am just asking what kind of Find' script he has.

If you are saying the access level privilege like Get (AccountName) or Get (PrivilegeSetName), it means that he could ask in http://fmforums.com/forum/showtopic.php?tid/193106/

Perfect link, henry. I think this is what the OP needs.

Thank you Bcooney :P

I was reading his another thread and saw this thread. So, it would be better for him to ask in the same thread instead of creating a new one :)

That does make Lee very happy!

Hi Barbara, I merged the two topics.

and will notify the OP.

  • Author

thank you. this was most helpful and works well. the link you sent me too didn't work as well for me as it never allowed me to put that equation into the calculation....i also think its cleaner doing it your way without having to add a field to all of the tables.

you DO have to add a field to every table, the field that autoenters the creator's AccountName.

  • Author

BTW, is there a way to copy/paste it rather than retyping it?

Find All Records

Perform Find [Omit Records where 'user'=""]

I wasn't sure if i needed to do a findall first or not. Anyway, this seems to work--do you see any problem with doing it like this? A Better way?

the link you sent me too didn't work as well for me as it never allowed me to put that equation into the calculation

I included that link so you can read about how Find and GTRR behave with restricted access records. The method suggested at the beginning of the thread is dubious, at least.

  • Author

got it. i guess either method is the same in that regard. good point.

  • Author

yes, that was VERY cool to know that about Find and restricted access records. i couldn't really think of a find that would be like a 'find all'...maybe something where recordID isn't empty, but i don't see how one specifies empty or nonempty.

It's all in that thread.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.