Idahomail Posted March 19, 2021 Posted March 19, 2021 Hello, I'd like to record when a user views a record, and then have a layout where the "Unviewed By Me" records become bold. This idea is similiar to "Unread" in most email programs, but it is generated from a shared set of records instead of only emails delivered to me. I know that I can create a subtable to create a record each time someone views a record. I don't need an audit trail of when or how many times they viewed it, just the LAST time, if they have viewed it at all- which makes me think I want this info in the record in question, not through a relationship. I only have 4 users, and I don't need this to scale up to more users. Would it be a bad idea to just add fields in the table for: Viewed_user1, Viewed_user2, etc. and then do a script where when a record is viewed, Get the user name Set the field (that matches the username) to the Timestamp. I think this would work- but I'm not sure if it's the best way to tackle it. Any thoughts would be appreciated. Thanks
comment Posted March 19, 2021 Posted March 19, 2021 (edited) 1 hour ago, Idahomail said: Would it be a bad idea to just add fields in the table for: Viewed_user1, Viewed_user2, etc. Yes, it would. You say you only have 4 users now - but users come and go. Adding/deleting a user should not require a change in the file's schema. If you want to keep this simple, then use a single text field that stores a return-separated list of the users (or, preferably, account names) that have viewed the record. Then it's easy to apply conditional formatting using the expression = IsEmpty ( FilterValues ( Get ( AccountName ) ; YourTable::ViewLog ) ) --- Note that keeping the view log within the record itself means that the record will be modified anytime someone views it for the first time. And also that the log cannot be added to if the record is locked by another user at the same time. These problems would not exist if the log was kept in a related table. And you could still create a related record only when someone views the parent record for the first time. Edited March 19, 2021 by comment 1
Idahomail Posted March 19, 2021 Author Posted March 19, 2021 Thank you for a fast response. In your first solution, do I create a script to append to the YourTable::Viewlog field? And, in theory, if I wanted an "Unview" button, I'd have to delete that account name from the list? I was avoiding a related table to reduce overhead- it seems like in a list view, there's going to be a lot of calculating happening in order to do the coniditional formatting for what could be 1000's of records and I thought it would be better to keep it in the same record. In the case of a related table, would it look like this: [Main Table] RecordID RecordField1 RecordField2 [Log Table] LogID RecordID>FK Account (that viewed it) Timestamp Script: FIND related Values in LogTable IF one of those records contains the Account - Do Conditional Formatting IF the records DO NOT return one with the Account, Create A New Record (and possibly loop, because it now meets the FIND Criteria) Thanks
comment Posted March 19, 2021 Posted March 19, 2021 (edited) 36 minutes ago, Idahomail said: In your first solution, do I create a script to append to the YourTable::Viewlog field? And, in theory, if I wanted an "Unview" button, I'd have to delete that account name from the list? Yes, to both. 36 minutes ago, Idahomail said: I was avoiding a related table to reduce overhead- it seems like in a list view, there's going to be a lot of calculating happening in order to do the coniditional formatting Not really. The calculation is the same, except that instead of the text field you would use List ( ViewLog::Account ). Alternatively, you could define the relationship as: YourTable::ID = ViewLog::YourTableID AND YourTable::gAccountName = ViewLog::AccountName Then it's just a matter of checking if a related record exists. In either case there is no need for a script. Edited March 19, 2021 by comment
Recommended Posts
This topic is 1344 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 accountSign in
Already have an account? Sign in here.
Sign In Now