Data Grid and Association, what am I doing wrong?

0
Something seems so easy but… I’m stuck! - Persistent entity JobTitle (JobId, JobDescription) - Peristent entity TeamMembers (TeamId, TeamName, JobId) - Association JobTitle_TeamMember ( 1 to many) Both tables have data. I’m unable to show the JobTitle.JobDescription in the grid view (Data source is JobDescription over the association). Thank you for your help.    
asked
6 answers
1

Massimo,

I would guess that there is no association value set for each TeamMember to the JobTitles entity.  Here is how you can check this:

  • If you have an Edit page button on the TeamMembers grid, open the Edit page in Studio Pro and add a reference selector that uses the TeamMembers_JobTitles association (you can display either the JobTitle ID or Description in this reference selector)
  • If you don’t have a Edit page button on that grid, add one, right mouse click on the button and select Generate Page from the context menu that appears.  Make sure the generated page has a reference selector for JobTitle (see first bullet point)
  • Now, run your app.  Navigate to the page with the datagrid and edit one of the TeamMembers records.  I am guessing the reference selector will be empty.  If so, select a job title for the record you have open and save it
  • You should see the job title for the record you just edited in your datagrid.

Hope that helps,

Mike

**EDIT**

I made a small example.

Here is the domain model

here is the microflow

Here is the JobTitle retrieve

Here is the Change action where the association is set

Hope that helps.

answered
1

Mike,

You made my day, great understanding of the problem, super solution.

You are the man! 

answered
0

Hi Massimo,

Can you check read access for attribute Jobdecription in JobTitle entity?

Thanks

answered
0

It seems to me permissions are ok.

answered
0

Hi Mike,

I think you are correct. I just had Studio Pro creating the overview pages for both the entities, added a new member by the TeamMember_Overview page, and everything works how it should.

But this brings up a different question, though. I’m building the 2 tables using a SQL query and a REST call and it seems the Mendix ‘association’ has a different meaning or, at least, different behavior, than a DB relationship, that is what I was expecting.

Based on your knowledge, is there a way to force rebuilding the ‘association values’  after populating the entity?

Thanks for your help.

Max

answered
0

Yes, I do have JobTitleId in both tables (classic relational model where TeamMembers.JobTitleID is the external key to create the relationship with JobTitle). I can create the microflow which loops through the TeamMembers table but I don’t understand how to set the association. Can you please explain it, if you don’t mind.

Thanks a lot!

 

answered