AnsweredAssumed Answered

Filter record on account basis so that each user can view only his/her record.

Question asked by Vicspidy on Feb 1, 2015
Latest reply on Feb 2, 2015 by philmodjunk

Title

Filter record on account basis so that each user can view only his/her record.

Post

I've two tables ARTIST and RECORD. I'm using WebDirect on my LAN. Each artist in my team have to enter in the RECORD table what he's done every day. They can create multiple records for a day. Now I only want that when a user logs in, he only sees his record (I've created a layout based on ARTIST table and I'm using portal to filter record for that artist on a specific day).

                                           Now The irony here is that I've filtered the record by studying a file (I download it from some site). But I'm not able to understand how it's working.Here is what I've setup so far...

                                      In file options (File Menu) I've a script trigger on OnFirstWindowOpen, where I'm setting GCurrentUser(Global Field) to Get(AccountName). I forgot to mention I've also a system table where there's only one field GCurrentUser.

                                     In the Layout setup I've a script trigger on OnLayoutEnter. Is is like this

                                    Set Error Capture [On]

                                    If [Get(CurrentPrivilegeSetName)= "[Full Access]"]

                                        Show All Records

                                    Else

                                        Show/Hide Toolbars [Hide]

                                        Enter Find Mode[]    // Nothing specified in here

                                        SetField[artist::c_user;Get(AccountName)]

                                        Perform Find []  // Nothing specified here

                                     Endif

Then in Manage Security I've defined a Privilege Set called Artist where for the artist table in the view section I've set it to Limited and for the calculation I've written this 

                                      Get(AccountName)=system:gCurrentUser

and it is giving me what I want but i don't know how maybe becauseI've not understood how Gobal field works.

Outcomes