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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Multi Table lookup fields

(1) ShareShare
ReportReport
Posted on by 114
I have a form with 2 datasources QuotationTable and QuotationLine.. QuotationLine has a field called ItemId related to InventTable. I want to override the lookup for ItemId 
 
so, I tried to override lookup method of itemId field in QuotationLine but it gave me the error that 2 lookup forms trying to open! So I override the event handler of ItemNumber control in the grid.
- the sysTableLookup has QuotationLine as a parameter but it isn't used as qbds below.
- I tried to have Quotation line as qbds and then link qbdsInventTable with it and I get the error: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt"
- the error I get: 'Failed to execute query because no root data source on the form matches the root datasource on the query.'
 
I have the same question (0)
  • Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    Hi,
     
    SysTableLookup doesn't support adding fields from multiple tables.
    You could create a View with all of those joins and use it with sysTableLookup
     
    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • GirishS Profile Picture
    27,827 Moderator on at
    Hi Abdullah,
     
    As mentioned, you can create a view and consolidate all the tables there.
    One more option is to check whether there is any method available in InventTable to fetch ProductName and ItemGroupId values. If the method is available, you can use lookupTable.addLookUpMethod(tableMethodStr(TableName,MethodName) to mention the table and method name.
     
    Thanks,
    Girish S.
  • Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
    Hi,
     
    As mentioned, you should either create a view or create display method and use it in your lookup.
     
     
    Thanks
    Waed Ayyad
     
  • Abdullah_Ahmed Profile Picture
    114 on at
    Thank you all for your answers.. I tried the view and it worked but has a problem! there are many duplicates in data and I don't know why.. I tried to create unique index on itemId but it doesn't reflect on the database and I can't find the index in the view in sql server.
     
    I found the methods in InventTable so I used them instead and it's working fine.. but I wanna figure out what's happening with the view!
  • GirishS Profile Picture
    27,827 Moderator on at
    If you find any duplicates maybe you missed the relation between the tables, you added as DataSource in view.
     
    Thanks,
    Girish S.
  • Abdullah_Ahmed Profile Picture
    114 on at
    I didn't forget to set UseRelations to yes and I still have the problem!
  • GirishS Profile Picture
    27,827 Moderator on at
    I think EcoResProductTranslation has LanguageId field, please try setting that language id and check.
     
    Thanks,
    Girish S.
  • Abdullah_Ahmed Profile Picture
    114 on at
    This is the view now.. I can't add relations manually so I just set UseRelations to yes in both tables (InventItemGroupItem and EcoResProduct)... 
     
    - InventItemGroupItem should relate to InventTable by ItemId field
    - EcoResProductTranslations  should relate to InventTable by Product field
    - The index is unique and it didn't help either!
  • GirishS Profile Picture
    27,827 Moderator on at
    Can you tell me why you are unable to add the relations manually?
    Use relations will work only if there is a relation added between the tables at table level.
    If there is no relation added between the tables, then you need to add the relation manually and mention the related fields. You won't get unique values unless you correct the relation between the tables.
     
    Thanks,
    Girish S.
  • Abdullah_Ahmed Profile Picture
    114 on at
    I wasn't able to add relation manually because I set UseRelations to Yes.. once I set it to no I added relations manually and added a range on InventTable DataAreaId field and set the value to curExt().
    This is working now and there are no duplicates at all.
     
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans