Enter the key words to find the related topics

Showing posts with label How to add link to the parent of parent Datasource in QueryBuildDataSource. Show all posts
Showing posts with label How to add link to the parent of parent Datasource in QueryBuildDataSource. Show all posts

How to add link to the parent of parent Datasource in QueryBuildDataSource

 
   
  1. QueryBuildDataSource      qbdsInventTrans;
  2. QueryBuildDataSource      qbdsinventDim;
  3. QueryBuildDataSource      qbdsInventBatch;
  4.  
  5. query = new Query();
  6.  
  7. qbdsInventTrans    = query.addDataSource(tableNum(InventTrans));
  8. qbdsinventDim      = qbdsInventTrans.addDataSource(tableNum(InventDim));
  9. qbdsinventDim.relations(false);
  10. qbdsinventDim.fetchMode(JoinMode::InnerJoin);
  11. qbdsinventDim.addLink(fieldNum(InventTrans,inventDimId),fieldNum(InventDim,InventDimId));
  12. qbdsInventBatch   = qbdsinventDim.addDataSource(tableNum(InventBatch));
  13. qbdsInventBatch.relations(false);
  14. qbdsInventBatch.fetchMode(JoinMode::InnerJoin);
  15. qbdsInventBatch.addLink(fieldNum(InventDim,inventBatchId),fieldNum(InventBatch,inventBatchId));
  16. qbdsInventBatch.addLink(fieldNum(InventTrans,ItemId),fieldNum(InventBatch,itemId),qbdsInventTrans.name()); 
  17.  
  18. qr = new QueryRun(query);
  19. info(strFmt(qr.toString()));
 Look into the line 16 where the line is bowled if we observer that parameters we see it has three  where last parameter is parent data source.
If we wont specify the parameter we get an error as shown below.