while working with data entities we can use following code to refer entity current record and datasource reference:
public final class FRESalesInvoiceHeaderV2Entity
{
/// <summary>
///
/// </summary>
/// <param name="_sender"></param>
/// <param name="_eventArgs"></param>
[DataEventHandler(tableStr(SalesInvoiceHeaderV2Entity), DataEventType::InitializingEntityDataSource)]
public static void SalesInvoiceHeaderV2Entity_onInitializingEntityDataSource(Common _sender, DataEventArgs _eventArgs)
{
DictDataEntity dictEntity = new DictDataEntity(tableName2Id("SalesInvoiceHeaderV2Entity"));
Query salesInvoiceHeaderQuery;
QueryBuildDataSource custInvoiceTableDatasource, custInvoiceJourDatasource;
QueryRun run;
if (dictEntity)
{
salesInvoiceHeaderQuery = dictEntity.query();
custInvoiceJourDatasource = salesInvoiceHeaderQuery.dataSourceNo(1);
custInvoiceTableDatasource = custInvoiceJourDatasource.addDataSource(tableNum(CustInvoiceTable));
custInvoiceTableDatasource.joinMode(JoinMode::NoExistsJoin);
custInvoiceTableDatasource.addLink(fieldNum(CustInvoiceJour, InvoiceId),fieldNum(CustInvoiceTable, InvoiceId));
custInvoiceTableDatasource.fetchMode(QueryFetchMode::One2One);
run = new QueryRun(salesInvoiceHeaderQuery);
run.run();
}
}
}
Comments
Post a Comment