reporting services - SSRS X++ contact query -
i'm trying put multiple queries in ssrs report data validation. @ glance display address/contact info, project info, customer info, supplier info , resource info. i've started on address/contact info seem have gotten bit stuck...
i'm getting invalid field combination error logisticselectronic address tables, , i'm trying return locator field twice based on different joins.
i know how in sql easy using left joins , aliased fields i'm beginner in x++ , not sure how this. appreciated!
public class datavalidation extends srsreportdataproviderbase { tmpaddresses tmpaddresses; tmpprojects tmpprojects; tmpsuppliers tmpsuppliers; tmpcustomers tmpcustomers; tmpresources tmpresources; [srsreportdatasetattribute('tmpaddresses')] public tmpaddresses getaddresses() { select tmpaddresses; return tmpaddresses; } public void processreport() { query q; queryrun qr; querybuilddatasource qbds; querybuildrange qbr; // declare table buffer dirpartytable dirpartytable; logisticslocation logisticslocation; logisticspostaladdress logisticspostaladdress; logisticselectronicaddress logisticselectronicaddress; q = new query(); qbds = q.adddatasource(tablenum(dirpartytable)); qbr = qbds.addrange(fieldnum(dirpartytable, name)); qbr.value('!""'); qbds = qbds.adddatasource(tablenum(logisticspostaladdress)); qbds.addlink(fieldnum(dirpartytable, primaryaddresslocation),fieldnum(logisticspostaladdress, location)); qbds.joinmode(joinmode::outerjoin); qbds = qbds.adddatasource(tablenum(logisticselectronicaddress)); qbds.addlink(fieldnum(dirpartytable, primarycontactemail),fieldnum(logisticselectronicaddress, recid)); qbds.joinmode(joinmode::outerjoin); qbds = qbds.adddatasource(tablenum(logisticselectronicaddress)); qbds.addlink(fieldnum(dirpartytable, primarycontactphone),fieldnum(logisticselectronicaddress, recid)); qbds.joinmode(joinmode::outerjoin); qbds = qbds.adddatasource(tablenum(logisticslocation)); qbds.relations(true); qbds.joinmode(joinmode::outerjoin); qr = new queryrun(q); while(qr.next()) { dirpartytable = qr.get(tablenum(dirpartytable)); logisticslocation = qr.get(tablenum(logisticslocation)); logisticspostaladdress = qr.get(tablenum(logisticspostaladdress)); logisticselectronicaddress = qr.get(tablenum(logisticselectronicaddress)); tmpaddresses.clear(); tmpaddresses.name = dirpartytable.name; tmpaddresses.address = logisticspostaladdress.address; tmpaddresses.description = logisticslocation.description; tmpaddresses.email = logisticselectronicaddress.locator; tmpaddresses.phone = logisticselectronicaddress.locator; tmpaddresses.insert(); } }
}
your child datasources should refer dirparty
:
qbdsprimary = q.adddatasource(tablenum(dirpartytable)); qbr = qbdsprimary.addrange(fieldnum(dirpartytable, name)); qbr.value('!""'); qbds = qbdsprimary.adddatasource(tablenum(logisticspostaladdress)); qbds.addlink(fieldnum(dirpartytable, primaryaddresslocation),fieldnum(logisticspostaladdress, location)); qbds.joinmode(joinmode::outerjoin); qbds = qbdsprimary.adddatasource(tablenum(logisticselectronicaddress)); qbds.addlink(fieldnum(dirpartytable, primarycontactemail),fieldnum(logisticselectronicaddress, recid)); qbds.joinmode(joinmode::outerjoin); qbds = qbdsprimary.adddatasource(tablenum(logisticselectronicaddress)); qbds.addlink(fieldnum(dirpartytable, primarycontactphone),fieldnum(logisticselectronicaddress, recid)); qbds.joinmode(joinmode::outerjoin); qbds = qbdsprimary.adddatasource(tablenum(logisticslocation)); qbds.relations(true); qbds.joinmode(joinmode::outerjoin); // verify query info(qbdsprimary.tostring());
Comments
Post a Comment