Open Record based on UserName
Good morning!
I am trying to make my database more user friendly and was wondering the following.
I have a table called Timesheet. I have a dashboard too. When a user clicks the "Login" button on the dashboard it opens up a new record in timesheet where they fill in the date, Time and they select their name from a related table "Staff".
Now I'd like them to be able to log out the same way. So click the Logout button on the dashboard to open the last record in Timesheet that they created. I was trying to use the userName() function, but this doesn't seem to be working. Is there anyway that I can use to have them up the last record they created in Timesheet? I have tested this with the last(select Timesheet) but that just opens the last record irrespective of who created it.
THanks for your help once again!
8 replies
-
let t := this; openRecord(last(select Timesheet[Staff.name = t.'created by']))
This is assuming your username is the same as what it is stored as in the staff table, otherwise
let t := this; openRecord(last(select Timesheet[userName() = t.'created by']))
-
May I suggest that you use your dashboard (or new pages) to show the data that you want to show, instead of pulling up the record and exposing your raw data to your end users. As we know we can't trust users.
Content aside
- Status Answered
- 11 mths agoLast active
- 8Replies
- 77Views
-
3
Following