Hi,

i would try this:

    qbds1 = qbds.addDataSource(tablenum(InventDim));
    qbds1.joinMode(joinmode::InnerJoin);
    qbds1.fetchMode(0);
    qbds1.addLink(fieldnum(InventJournalTrans, InventDimId), 
fieldnum(InventDim, InventDimId));
    qrange = qbds1.addRange(fieldnum(InventDim, InventLocationId));
    qrange.value('01');

    qbds2 = qbds.addDataSource(tablenum(InventTable));
    qbds2.joinMode(joinmode::InnerJoin);
    qbds2.fetchMode(0);
    qbds2.addLink(fieldnum(InventJournalTrans, ItemId), fieldnum(InventTable, 
ItemId));
    qrange = qbds2.addRange(fieldnum(InventTable, ESG_ProductType));
    qrange.value(PrdType);

fetchMode indicates who record are retrieved, 1:1 or 1:n. The second results in 
subqueries, which actually is not an inner join.

Regards
Andreas Gahr

-----Ursprüngliche Nachricht-----
Von: Anton Tjiptadi [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 7. April 2005 03:55
An: Axapta-Knowledge-Village@yahoogroups.com
Betreff: [Axapta-Knowledge-Village] Re: Joining 3 tables with
QueryBuildDataSource ?




Hi Jesper, Thanks for your reply, but actually I already tried that 
and result is also wrong.

If I debug it, the result query ->

qbds = SELECT * FROM InventJournalTrans

qbds1 = SELECT * FROM InventDim 
WHERE InventJournalTrans.InventDimId = InventDim.inventDimId AND 
((InventLocationId = 01))

qbds2 = SELECT * FROM InventTable 
WHERE InventJournalTrans.ItemId = InventTable.ItemId AND 
((ESG_ProductType = 11))

.... seems like all the joining is lost ???

thx,
Tonz



--- In Axapta-Knowledge-Village@yahoogroups.com, 
<[EMAIL PROTECTED]> wrote:
> Hi,
> 
> in that case you should join qbs2 on qbs, not qbs1
> 
> /jesper
> 
> -----Ursprüngliche Nachricht-----
> Von: Anton Tjiptadi [mailto:[EMAIL PROTECTED] 
> Gesendet: Mittwoch, 6. April 2005 13:21
> An: Axapta-Knowledge-Village@yahoogroups.com
> Betreff: [Axapta-Knowledge-Village] Joining 3 tables with 
QueryBuildDataSource ?
> 
> 
> 
> Hi,
> I want to join 3 tables with QueryBuildDataSource (QBDS), the 
> statement is like this :
> 
> qbds = q.addDataSource(tablenum(InventJournalTrans));
> 
> qbds1 = qbds.addDataSource(tablenum(InventDim));
> qbds1.joinMode(joinmode::InnerJoin);
> qbds1.addLink(fieldnum(InventDim, InventDimId),fieldnum 
> (InventJournalTrans, InventDimId));
> qrange = qbds1.addRange(fieldnum(InventDim, InventLocationId));
> qrange.value(WareId);
> 
> qbds2 = qbds1.addDataSource(tablenum(InventTable));
> qbds2.joinMode(joinmode::InnerJoin);
> qbds2.addLink(fieldnum(InventJournalTrans, ItemId), fieldnum
> (InventTable, ItemId));
> qrange = qbds2.addRange(fieldnum(InventTable, ESG_ProductType));
> qrange.value(PrdType);
> 
> -------------
> ...the goal is, I want join table InventJournalTrans to InventDim 
> with key InventDimId and join table InventJournalTrans to 
> InventTable with key ItemId, but.....
> 
> 
> strange thing is the result query is like this :
> SELECT * FROM InventJournalTrans 
> JOIN * FROM InventDim WHERE InventJournalTrans.InventDimId = 
> InventDim.inventDimId 
> AND ((InventLocationId = 01)) 
> JOIN * FROM InventTable WHERE InventDim.InventLocationId = 
> InventTable.ItemId 
> AND ((ESG_ProductType = 11))
> 
> ---> failure is the join between InventJournalTrans and 
InventTable 
> went in to the wrong key, was I making a mistake in QBDS ??
> 
> can anyone help me ?
> 
> thanks in advance,
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Sharing the knowledge on Axapta. 
> Yahoo! Groups Links






Sharing the knowledge on Axapta. 
Yahoo! Groups Links



 






------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/kGEolB/TM
--------------------------------------------------------------------~-> 

Sharing the knowledge on Axapta. 
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