addFoundSetFilterParam over a relation

Hello,

I have just come across this issue: I sit on a table of let’s say appointments. Appointments can be linked to several users. Now I want to make a “view”, where a user sees appointments, but only those, where he is a participant.

If I try something like:

controller.addFoundSetFilterParam('appointments_to_appt_to_users.user_id', '=', security.getUserId());

I get “false”. I suppose, this is not supported. Does anyone have an idea of what to do in this case?

Thanks Patrick

Notice that the command is CONTROLLER.addFoundSetFilterParam() - that means that it works on the controller object - not on the “relation” node. Simply go to the child table’s form - and add the controller.addFoundSetFilterParam to that form.

The problem is: there is no child form.

We have two tables

  • appointments
  • appointments_to_users

I want to present in a form all appointments that have an entry in appointments_to_users for the current user.

How do I do that?

I know I can base my form on appointments_to_users and show appointments through a relation. But that seems a much heavier operation to me than just show data straight and filter before I load the data.

that means that it works on the controller object

That’s exactly what I want! But I want to filter on a related criteria.

That’s a good feature request.

How are you showing the appointment data now? Portal? DON’T! Use a new FORM and show it in a tabless tabpanel (you can make that form in table view to mimic the appearance of a portal).

It’s just a table view. I simply show all appointments, but want to limit the ones I show to the current user.

If you’re just showing the table view - not in a tabpanel - then where’s the problem??

Add this method to the onShow of the form:

controller.find()
appointments_to_appt_to_users.user_id = security.getUserId()
controller.search()

Should work like a charm!

Not so charming is that I have to take care of that after almost every move the user makes. I have, for example, a global rapid search (one field) that uses a global field and a global method. In that I would have to figure out, that in this case I came from here and I have to do some extra searching.

Not a solution, I’m afraid.

if you want to add foundsetfilter params to a relation. Why aren’t you adding these to the relation itself?

I don’t want to show the related records, but the main table’s records. Once more the setup:

  • Table A (the one I want to show)
  • Table B (users)
  • Table A_to_B (users linked to table A)

I want to have a form based on Table A but filter on the current user.

I see, we will checkout if we can support related filter params..

Thanks!

I’ll watch this post and keep my fingers crossed.

Being able to filter a form’s foundset permanantly is pretty neat from my perspective. It would only get better if we can filter by more then just the local fields.

Jim