How to constrain a datagrid object A on a relation with dataview object B?

0
I have an object B (Project) and I have an object A (PersonWorkWeek). The relation between the two is that PersonWorkWeek is related to Work and Work is related to a Project. Now I want to show an overview of PersonWorkWeeks that are related to Work records that have a relation to a certain Project. Therefore I made a dataview on Project and a datagrid on PersonWorkWeek. Next thing is to constrain PersonWorkWeek on the relation as described. I don't understand how to do this as the XPath constraint does not allow me to work with the Project as an object. And I do not have a CurrentObject. Especially the last thing I didn't expect. Also from reading on the forum, I expected to have a CurrentObject available as XPath element. Update: '[%CurrentObject%]' is available as a XPath element. First, I was not able to select it from the auto complete dropdown, now I am. I guess the problem is between the chair and the keyboard.
asked
5 answers
1

If I understand correctly your current object would be the Project. You placed the grid inside the dataview_project, how did you link the grid?

Screenshots ?


Normaly you would constrain a grid representing a "subordinate" by going to that object trough the relations. In your case I assume you link the grid to the object and are trying to constrain the resulting query result.

When making the constraint, remeber that you are constraining the RESULTS so you are looking outside-in, not inside out.

Domain like this ? alt text

answered
1

So, Project-Work (1-many) and Work-PersonWorkWeek (1-many) are your relations right?

Then a dataview with Project, filled with a datagrid with PersonWorkWeek and the following Xpath should do the trick:

[Module.PersonWorkWeek-Work/Module.Work/Module.Work-Project = '[%CurrentObject%]']

answered
0

The model is a bit different:

  • Project-Work (1-many) and

  • PersonWorkWeek-Work (1-many).

I tried to do what Bram wrote below, but I'm not getting the option to choose '[%CurrentObject%]'.

[Module.PersonWorkWeek-Work/Module.Work/Module.Work-Project = '[%CurrentObject%]']

answered
0

In this case your best bet is to set a relation between Project and PersonWorkWeek. Set this relation when both Project-Work and PersonWorkWeek-Work exist for the same Work object. You can now show the relation Project-PersonWorkWeek in the datagrid you intented.

answered
0

Hi Lex, Bram,

Thanks for helping me. In the end, the problem only was that '[%CurrentObject%]' is not in the dropdown of the autocomplete and I, therefore, thought that I couldn't use it. Mistyping didn't help. It's simply working as expected.

Now I am able to filter the PersonWorkWeek records based on the fact that the Work record is related to the Project. Here is the model again.

  • Project-Work (1-many) and

  • PersonWorkWeek-Work (1-many).

And, as Bram already suggested, this is the working filter:

[Module.PersonWorkWeek-Work/Module.Work/Module.Work-Project = '[%CurrentObject%]']

answered