set a filter on a table based on username with a button group

Hello everybody

I need your help with a button group. I want to set a filter on a table after clicking on one of the buttons. Especially I need help with this use case:

The table shows a lot of different tasks. One task belongs to one user. One user can be responsible for different tasks. So what I want to achieve is that the user clicks on the button ("meine tasks" = my tasks) and the table only shows those tasks (those rows) that belong to the users name or the users ID. I don't know how to compare/link the users name or ID with the data in the database and how to refresh the table on the screen.

The screenshots show the current screen with the button group. My question refers to the button group on top.

Thank you in advance!


Rank: #2431

Hey Leonie,

All you need to do is make a local variable userid. And add the following filter to the table: 

UserId= nullidentifier() or userid = user.id

The value of your all button = nullidentifier() and the value of your my button = getuserid()

Check oml for a working example


Rank: #56

Hi Leonie,

You should have a variable of type User Identifier, in my example UserId, which you should use as the variable of the ButtonGroup widget:

Then on the All Tasks Button Item, you should set the value NullIdentifier() and for the My Tasks Button Item, you should set the value GetUserId()

Now on your query, you should add a filter UserId = NullIdentifier() or Task.UserId = UserId.

In my example, I am filtering by Task.UserId field and you should adapt this to the entity and attribute you want to filter with.


Rank: #28662

What you can do.

First, on your preparation or aggregate make sure you have a filter.
like "WHERE ({Task}.[UserId] = @UserId OR @UserId = null)" 

This sample is for advance query, but it will be same context for Aggregate.

This is for My Task Button.

  1. Create a Local variable in the Screen called UserId (default null)
  2. Attach an OnClick Handler on the "My Task" button.
  3. Inside the OnClick Handler set UserId = Current Logged In User Id.
  4. Now Refresh the preparation or aggregate that lists the records.

This is for the All Task Button?

  1. Inside the OnClick Handler set the UserId = NullIdentifier()
  2. Now Refresh the preparation or aggregate that lists the records.

Now, you have a dynamic data base on the selected filter/button.

Rank: #55376

Hi, thank you for your suggestions.

I tried to change the points you've told me. Unfortunately it still doesn't work.

Maybe you can tell me what I did wrong with the attached oml (have a look at "Startseite_Bank")


Rank: #2431

Hi Leonie,

Try removing the assign in your onchange for the buttongroup, your overwriting your userid there while you don't have to.

Rank: #127

Agree with Nick,

you already have an onchange on the userBar, no need for an extra onChange on the Meine button.

But you have some deeper issues going on.   If you want to filter tasks based on logged in user, then you will have to somehow link tasks to users in your data model.  All you are doing now, is linking tasks to a Mitarbeiter, but Mitarbeiter has no link to logged in user.  So this won't work.

Your query says

UserId = NullIdentifier() or Tasks.MitarbeiterInnenId = UserId

that will only work if your mitarbeiterinnen id is in effect a userId, in your current datamodel design it is just a completely unrelated autonumber.


I think the mobile instruction videos and exercises might be interesting for you, as they also build a task list.