web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Answered

Problem adding fields from different datasources to one grid on form

(0) ShareShare
ReportReport
Posted on by 1,673

Hi everyone

When I add fields from several datasources (ie. 2 datasources) onto 1 grid, I get the error 'Field1 must be filled in'. There are a million ways to resolve this problem I'm sure, but I want to make sure I'm not making a stupid mistake, and want to do it within Best Practice

I have three tables: A, B (with fields: PKField, Field1, Field2), ABLink (with fields RecIdOfA, RecIdOfB)

On the form I have a grid in which I display data from table A, and another grid on which I want to add/delete records in ABLink, but display data from B. So on my form, I add all three tables, I link ABLink to A, and I link B to ABLink with an inner join. I set the second grid's datasource property to ABLink, and I drag ABLink.RecIdOFB onto the grid. I also drag Field1 and Field2 of Table B onto the grid. I set the allowAdd, allowEdit, allowDelete properties of TableB to NO.

Everything works perfectly as far as displaying data is concerned, but when when I add a record in grid 2 and try to save the record, I get an error saying 'TableB.PKField must be filled in'. This happens because when I create a new record on the grid linked to ABLink, it also creates a record in TableB for some reason.

To resolve this I could, 

- write display methods for Field1 and Field2 (but I want to avoid display methods in this case for performance)

- change the join type from inner to passive and then manipulate the relationships via active() or linkActive() etc

- I supposed there are several other ways too. But it all seems unnecessary. I'm sure it must be simpler. Can anyone see what I'm doing wrong? Inner oin seems to be the correct option, but I can't add a record correctly. What am I doing wrong?

Thanks

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mea_ Profile Picture
    60,286 on at

    Hi BrandonSA,

    If you want to use table B only to display data your case is similar to InventDim table. Take a look at any form in AX where inventdim is used in a grid to find standard way of handling this issue. It involves modifying write and validateWrite methods on  datasource to comment out super(), so record won't be saved and validated.

  • BrandonSA Profile Picture
    1,673 on at

    Thank you ievgen

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sanhthosh.Kumar.K Profile Picture

Sanhthosh.Kumar.K 2

#2
Raed Salah Bzour Profile Picture

Raed Salah Bzour 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans