Passing values

Hi all

I have a report which requires the values to be fetched from several tables which has a record in Sales Order table.

So i want relevant fields data to be displayed …

So how can i get it ?

hi ,

Try to fetch data on basis of salesid… can u be clear with requirment for better suggestions

can u be clear with the requirement…

try to use primary index that is sales id from sales order table to fetch data from other table…

hi Lalit,

you can achieve this by joining the datasources. i have done same customization. have a look into following code you will get an idea.

public boolean fetch()
{
Query qr;
QueryRun queryrun1;
QueryBuildDataSource qbds1,qbds2,qbds3,qbds4;
QueryBuildRange qbr1,qbr2,qbr3;
utcdatetime fdate,tdate;
TimeZone tz;
int count1;
;
fdate = Global::datetobeginUtcDateTime(fromdate,tz);
tdate = Global::datetoendUtcDateTime(todate,tz);

qr = new Query();

qbds1 = qr.addDataSource(tablenum(SalesTable));
if(fromdate != datenull())
{
qbds1.addRange(fieldnum(SalesTable,createdDateTime)).value(queryrange(fdate,tdate));
}
qbds1.addGroupByField(fieldnum(SalesTable,SalesId));
qbds1.addRange(fieldnum(SalesTable,SalesId));
qbds1.addRange(fieldnum(SalesTable,CustAccount)).value(custaccount);

qbds2 = qbds1.addDataSource(tablenum(SalesLine));
qbds2.addLink(fieldnum(SalesLine,SalesId),fieldnum(SalesTable,SalesId));
qbds2.joinMode(JoinMode::InnerJoin);
qbds2.relations(true);
if(ItemId)
{
qbr1 = qbds2.addRange(fieldnum(SalesLine,ItemId));
qbr1.value(ItemId);
}
qbds3 = qbds2.addDataSource(tablenum(InventTable));
qbds3.addLink(fieldnum(InventTable,ItemId),fieldnum(SalesLine,ItemId));
qbds3.joinMode(JoinMode::InnerJoin);
qbds3.relations(true);
if(itemGroup)
{
qbr2 = qbds3.addRange(fieldnum(InventTable,ItemGroupId));
qbr2.value(itemGroup);
}

queryrun1 = new QueryRun(qr);

while(queryrun1.next())
{
_SalesTable = queryrun1.get(tablenum(SalesTable));
this.send(_SalesTable);

}

return true;
}

try it let us know if any thing help required…:slight_smile:

please mark as verified solutuion if you got the solution through this…

override the fetch method and write your code…