Hi, all
I want to overwrite the default relation between two datasources but not affect the other relations. Is there a way to do this?
The scenario is that:
Table InventJournalTrans has two fields: InventDimId and ToInventDimId, these two fields both has the relation with InventDim.InventDimId.
The default relation between InventJournalTrans and InventDim is InventJournalTrans.InventDimId = InventDim.InventDimId
Now, in a form, I create three datasources:
InventJournalTrans, InventDimA (inner join) and InventDimB (inner join)
Now I want to change the relation between InventJournalTrans and InventDimB to InventJournalTrans.ToInventDimId = InventDimB.InventDimId,
but not affect other relations, especially InventJournalTrans.InventDimId = InventDimA.InventDimId.
Is there a way to overwrite the relation between InventJournalTrans and InventDimB?
I tried to clearLink(), and then addLink, but this will affect other relations.
Thank you in advance.
The latest version of AX is Dynamics AX 2012 R3. I don't believe it's what you're using - the [DataSource attribute suggests that this is actually F&O and this thread belongs to another forum. Am I right?
What about the other part of the question: ow it affected other relations? Please look at the current query string and share it with us.
By the way, your code can be simplified a bit:
public void init() { super(); QueryBuildDataSource qbds = this.queryBuildDataSource(); qbds.clearLinks(); qbds.addLink(fieldNum(InventJournalTransHistory, ToInventDimId), fieldNum(InventDim, InventDimId)); }
Now I directly write a data method to retrieve the field I need. But I am still curious how to resolve this issue.
Hi, Martin, thanks for your reply.
The version of AX is the lastest. The code is as below:
[DataSource] class InventDimReceipt { public void init() { super(); QueryBuildDataSource qb; qb = this.query().dataSourceNo(this.name()); qb.clearLinks(); qb.addLink(fieldNum(InventJournalTransHistory, ToInventDimId), fieldNum(InventDim, InventDimId)); } }
Please explain how you used clearLink() and addLink() and how it affected other relations. Did you call it on InventDimB?
Also, what is your version of AX?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156