Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Filter based upon author()

81 views
Skip to first unread message

Aaron Dahl

unread,
Aug 11, 2018, 11:03:10 PM8/11/18
to mementodatabase
This seems like a fairly simple task, but I cannot figure it out. I would like to set up universal filters that filter data in a table based upon a particular field equal to (or potentially containing) the author name. Under the Filter option, I've added author(), and 'author()', but this is not working as hoped.

Thanks,

Bill Crews

unread,
Aug 11, 2018, 11:30:49 PM8/11/18
to Aaron Dahl, mementodatabase
You didn't tell us much about what you are wanting to do, but the general deal is that you have two ways of filtering concurrently. If you press the Filter button and set up a filter, it exists for you to use at any time using that button. However, you can also set up any or all of those defined filters as tabs. This enables two things -- to switch quickly between filters by tapping a tab, but mainly it allows you to invoke one filter by tapping its tab and another one concurrently by directly invoking the filter using the filter button. One is indicated by the selected tab, and the other by the name of the filter at the top of the screen. It is important to develop the habit of checking if a filter is used manually by checking up top; otherwise, you'll find yourself not realizing you are double-filtered.

A caveat with filters is that you can't count on them being saved or exported with a library, depending on how you do it, so if you have a filter setup you like, you may not be able to send the library to someone and have them use your setup.

Tomasz K.

unread,
Aug 12, 2018, 2:53:44 AM8/12/18
to mementodatabase
Hey
The author of the entry is not taken from the air :)
First you need to create a field in the library and name it somehow. In this example, AUTHOR.
Then you need to create a trigger script (when it will be executed it's your choice)

var e = entry ();
var login = e.author;
e.set ("AUTHOR", login);

And only now you will be able to set the filter on the AUTHOR field.

Have a nice day.

Aaron Dahl

unread,
Aug 12, 2018, 9:29:20 AM8/12/18
to mementodatabase
Thanks Thomasz.

This is for a time tracking library. I have a field "Employee" which runs a script when the entry is saved to collect the author():
entry().set("Employee", entry().author);

This works well to capture the user's name for each entry for three employees. When a user uses Memento, I want them to only see their own time entries (and aggregate only their hours for the week). I am trying to create a (default) filter which compares the "Employee" field of each record against the username of the instance and returns only those filtered records where "Employee" = author().

I wish to use similar functionality in another library (a Task List), but some tasks may be assigned to multiple people. In such a case I will wish to use a Contains function.

Any thoughts?

Thanks,

Aaron Dahl

unread,
Aug 12, 2018, 9:35:53 AM8/12/18
to mementodatabase
Thanks Bill.

This is for a time tracking application. I have set an "Employee" field which captures the username through the author() function. Since there are multiple individuals inputting data into this library, I wish to have a (default) filter which compares the "Employee" field against the username of the Memento Database instance. I.e. "Employee" = author().

Thanks,

Bill Crews

unread,
Aug 12, 2018, 10:44:09 AM8/12/18
to Aaron Dahl, mementodatabase
It sounds like you know something I don't. I know of no function author(). Assuming it is a global function, I tried...

message("Author is " + author());

...but it knows no such global function. So I tried...

message("Author is " + lib().author());

...and it finds no method author() within my library, either. So, what is author()?

We both know of the author property of the Entry object, but that's different.

It is easy to set up a tab for each possible author and have each of the users hit hers to see her list, but to allow her to see only her own list? I don't know how to identify the account, which is, I guess, the thing you want to test against.

I suppose you could create a bogus entry in the current library, get its author property value, and use that as the current account. But the filter itself is not set by script; you'd still have to set each user up with a filter equal to her account name. Then, you'd have the bogus entry to move to the Recycle Bin.

Aaron Dahl

unread,
Aug 13, 2018, 9:22:31 AM8/13/18
to mementodatabase
Thanks Bill.

Perhaps the fact this is not a global function is the specific reason I am not getting this to work. I call author (not author()) with set ("Employee", entry().author). The thinking is MDB has the user information when a user logs into the application. I should be able to use a filter to compare the value within the Employee field against the username (author) logged into the instance of Memento and return just that user's entries, right?

After some fiddling, I also see what you are referring to the the tabs and filters being "compounded" of sorts. If I select the tab labeled Last Week and the filter labeled This Week, nothing shows.

The bogus entry suggestion seems like it could work (it could just be a 0 hr entry), but I was hoping there was an easier method.

Bill Crews

unread,
Aug 13, 2018, 10:00:06 AM8/13/18
to Aaron Dahl, mementodatabase
Agreed. It would seem to be trivial for the developer to add a global user(), account(), or maybe author() function, but he has lots of ideas and not much time to implement them all. You probably know about Memento.UserVoice.com. It would be good to put this request in there. Maybe folks will vote for it.
Reply all
Reply to author
Forward
0 new messages