Hi,
   I am exploring the queryBuild family of classes. I am trying to 
use the queryBuildDynaLink class but can't get it to work. Here is 
the self contained X++ I am using. I want the Transactions query to 
be driven from data in the 'vt' buffer ie when the AccountNum field 
changes I want to retrieve a different set of associated 
Transactions. Currently the Transactions query does not retrieve 
anything at all regardless of which Vendor is current in the 'vt' 
buffer.

I am attempting this as an academic exercise in order to understand
the class. I have tried all sorts of wacky combinations and am close
to exploding with frustration :-)

(Is anyone else infuriated by the lack of detail in Help files for 
these System classes?)

Any suggestion as to why I am failing would be much appreciated.

 Query qVendors;
 Query qTransactions;

 QueryRun qrVendors;
 QueryRun qrTransactions;

 QueryBuildDataSource qdsVendors;
 QueryBuildDataSource qdsTransactions;

 QueryBuildDynaLink qDynaLink;

 VendTable vt;
 VendTrans vtr;

 ;
 qVendors = new Query();
 qdsVendors = qVendors.addDataSource(TableNum(VendTable));

 qTransactions = new Query();
 qdsTransactions = qTransactions.addDataSource(TableNum(VendTrans));

 qDynaLink = qdsTransactions.addDynalink(FieldNum(VendTrans, 
AccountNum),
                                            vt,
                                            FieldNum(VendTable, 
AccountNum));

 qrVendors = new QueryRun(qVendors);
 qrVendors.interactive(false);

 qrTransactions = new QueryRun(qTransactions);
 qrTransactions.interactive(false);


 if (qrVendors.prompt())
 {
  while (qrVendors.next())
  {
   vt = qrVendors.get(TableNum(VendTable));
   if (qrTransactions.prompt())
   {
    while(qrTransactions.next())
    {
     vtr = qrTransactions.get(TableNum(VendTrans));
     info(vt.AccountNum + ":" + vt.Name + " - " + date2str
(vtr.TransDate, -1, -1, -1, -1, -1, -1));
    }
   }
  }
 }








Sharing the knowledge on Axapta.
Visit www.frappr.com/axapta for axapta friends. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/Axapta-Knowledge-Village/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to