Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

AX 2009. Populate "sub-grid" on form.

$
0
0

VendTable form. Added a relation table using the TableGroupAll functionality. In a grid on the VendTable form, I am trying to display the values from the TableGroupAll that are relevant to it. I can't figure out how to make sure it's selecting the values for the current vendor only - the "sub-grid" always displays all the values from the Relation table, not just the ones that apply to that vendor.

For example, here is the case statement in the form datasource executequery method. I think that is part of the issue - when I mess with this query, it filters the main grid. Where would I put this if I only wanted to use this on just a section of the grid? I also suspect that I'm doing the join wrong.

Case 1 :

query  = new Query();

                   qbds_VendRelation = query.addDataSource(tablenum(VendRelation));

                   qbr_VendRelation = qbds_VendRelation.addRange(fieldnum(VendRelation,VendCode));

                   qbr_VendRelation.value(queryvalue("Group"));

                   qbr_VendRelation = qbds_VendRelation.addRange(fieldnum(VendRelation,Disapproved));

                   qbr_VendRelation.value(queryvalue('No'));

                   qbds_VendTable = qbds_VendRelation.addDataSource(tablenum(VendTable));

                           qbds_VendTable.relations(false);

                           qbds_VendTable.joinMode(JoinMode::ExistsJoin);

                           qbds_VendTable.addLink(

                               fieldnum(VendRelation,VendRelation),

                               fieldnum(VendTable,VendGroup));

                   qbr_VendTable = qbds_VendTable.addRange(fieldnum(VendTable,VendGroup));

                   qbr_VendTable.value(strFmt('(VendGroup == VendGroup)'));

                   queryRun = new QueryRun(query);

                   while (queryRun.next())

                       {

                           tmpVendRel_ds.ItemCode = VendRelation.ItemCode;

                           tmpVendRel_ds.VendCode = VendRelation.VendCode;

                           tmpVendRel_ds.VendRelation = VendRelation.VendRelation;

                           tmpVendRel_ds.Disapproved = VendRelation.Disapproved;

                           tmpVendRel_ds.insert();

                        }


Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>