Enter the key words to find the related topics

Insert_recordset using the Query class

Create Customer Tmp table                       
public void init()
{
    Map                                  targetToSourceMap;
    CustomerTmp                         customer;
    QueryBuildDataSource    qbdsGeneralJournalEntry;
    Query                                query;

    super();

    query = new Query();
    qbdsGeneralJournalEntry = query.addDataSource(tableNum(GeneralJournalEntry));
    qbdsGeneralJournalEntry.addSelectionField(fieldNum(GeneralJournalEntry, Ledger));
    qbdsGeneralJournalEntry.addSelectionField(fieldNum(GeneralJournalEntry, SubledgerVoucher));

    qbdsGeneralJournalEntry.addRange(fieldNum(GeneralJournalEntry, Ledger)).value(SysQuery::value(Ledger::current()));

    targetToSourceMap = new Map(Types::String, Types::Container);
    targetToSourceMap.insert(fieldStr(CustomerTmp, Ledger),   [qbdsGeneralJournalEntry.uniqueId(), fieldStr(GeneralJournalEntry, Ledger)]);
    targetToSourceMap.insert(fieldStr(CustomerTmp , SubledgerVoucher),   [qbdsGeneralJournalEntry.uniqueId(), fieldStr(GeneralJournalEntry, SubledgerVoucher)]);

    ttsbegin;

    Query::insert_recordset(customer, targetToSourceMap, query);

    ttscommit;

}

No comments:

Post a Comment