How to reference a report datasource table using x++
I'm unable to find the proper syntax for referencing the CustInvoiceTrans table of the SalesInvoice report datasource.
Here's the context: I've created a new classification开发者_如何学运维 field on the InventItemGroup table and need to get the data from this field for each item on the invoice, and then summarize this data on the header of the invoice.
Look at method fetch() of the SalesInvoice report.
while (tradeLoopTrans.next())
{
custInvoiceTrans = tradeLoopTrans.get(tablenum(CustInvoiceTrans));
// ....
this.send(custInvoiceTrans);
custInvoiceTrans is an each invoive line which will be printed in report.
Next look at Design, Section Group : CustInvoiceJour -> Section Group : CustInvoiceTrans. Here are all fields, which will be printed
So you need:
On the table CustInvoiceTrans create the display method:
display str getClassification() { InventTable table = InventTable::find(this.ItemId); InventItemGroup grp = InventItemGroup::find(teble.ItemGroupId); ; return grp.new_field }
This method return your classification for each CustInvoiceTrans.
On report design, on section Section Group : CustInvoiceTrans create a new field.
DataSource = CustInvoiceTrans DataMethod = getClassification
精彩评论