Tag new records & last edit with user name?

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Using Tap Forms Tag new records & last edit with user name?

Viewing 5 reply threads
  • Author
    Posts
  • January 22, 2019 at 1:57 PM #33513

    Stephen
    Participant

    Hi all,

    frequent user of simple TF databases here, often making use of Cloudant sync option to support multiple users. Looking ahead to my next project, we would like to deepen the integration of TF for tracking progress of the construction project. As the team become more dependant on the tables and the accuracy of the data in them, I’d like to make the users more accountable and be able to track who created, or last edited a record.

    Unfortunately I don’t have much idea how to go about this, or even if it’s possible? Any suggestions would be appreciated.

    Thanks in advance, regards, Stephen.

    January 23, 2019 at 1:00 AM #33524

    Brendan
    Keymaster

    Hi Stephen,

    If you add a Script field that returns record.deviceName;, that will display the name of the device that created the record.

    January 23, 2019 at 6:27 AM #33526

    Stephen
    Participant

    Hi Brendan,

    Thanks for the response. Do I simply create a ‘script’ type field and enter the text as you’ve written?
    I have attempted exactly that with the result set as text and I do not see anything in the form.

    Have I skipped an obvious step?

    Many thanks, Stephen.

    January 23, 2019 at 12:16 PM #33529

    Brendan
    Keymaster

    Hi Stephen,

    Yes, that’s right. Or you can just use this script:

    function Device() {
    	return record.deviceName;
    }
    
    Device();

    Try clicking the Refresh button at the bottom of the records list. You should see the value appear.

    Thanks,

    Brendan

    January 23, 2019 at 1:33 PM #33530

    Stephen
    Participant

    Thanks, for the clarification. I’ve stuck with the first option, it was a refresh as you suggested that displayed the value.

    So now it appears ALL the records I have were created by me…! I know that’s not true, so I guess I’m seeing myself listed as I’m the last user to interact with the records (I selected all records in table view to refresh them). Is there a way to manipulate the records as an ‘admin’ yet retain the last edits made by a ‘standard’ user?

    I suspect not, but thought I’d chance my arm and ask anyways…! ;)

    Stephen.

    January 23, 2019 at 3:01 PM #33533

    Brendan
    Keymaster

    I think I’m going to have to rethink how that deviceName property works. As you edit the records, the device name is stored on the record that edited it. But the script field also needs to be updated to show the deviceName value. And that causes a save to the database, which of course updates the database. I think I’m going to have to perhaps add something to the Script field that prevents it from updating the database, but to merely display the results. So maybe for now this is not going to work for you. Especially since if anyone else were to cause a Calculation field or a Script field to refresh across all records, they would effectively be updating every record, causing the deviceName property to be changed to their name.

    Tap Forms was never designed to be a multi-user database system and this was just a bit of a hack to see if I could display the name of the device that last made an edit to the record. It clearly needs some more thought and work.

    Sorry for getting your hopes up that this would be a viable solution.

Viewing 5 reply threads

You must be logged in to reply to this topic.