Announcements
XDSSalesTable xDSSalesTable;
Query q;
QueryBuildDataSource qbds;
QueryBuildDataSource qbds_Joined;
QueryBuildFieldList qbfl;
Map fieldMapping;
q = new Query();
qbds = q.addDataSource(tableNum(SalesTable));
qbds.addSelectionField(fieldNum(SalesTable,SalesId));
qbds.addRange(fieldNum(SalesTable,SalesStatus)).value('3');
qbfl = qbds.fields();
qbfl.dynamic(QueryFieldListDynamic::No);
qbds_Joined = q.dataSourceTable(tableNum(SalesTable)).addDataSource(tableNum(XDSCustTable));
qbds_Joined.addLink(fieldNum(SalesTable,InvoiceAccount),fieldNum(XDSCustTable,CustAccount));
qbds_Joined.addRange(fieldNum(XDSCustTable,UserId)).value('TestUser');
fieldMapping = new Map(Types::String,Types::Container);
ttsBegin;
fieldMapping.insert(fieldStr(XDSSalesTable,SalesId) ,[qbds.uniqueId(),fieldStr(SalesTable,SalesId)]);
Query::insert_recordset(xDSSalesTable,fieldMapping,q);
update_recordset xDSSalesTable
setting UserId = 'TestUser'
where xDSSalesTable.UserId == '';
ttscommit;
{Query object c3143e70:
SELECT SalesId FROM SalesTable(SalesTable_1)
WHERE (((SalesStatus == "3"))
JOIN CustAccount FROM XDSCustTable(XDSCustTable_1)
ON SalesTable.InvoiceAccount = XDSCustTable.CustAccount
AND ((UserId = N'TestUser'))}
XDSSalesTable xDSSalesTable;
Query q;
QueryBuildDataSource qbds;
QueryBuildDataSource qbds_Joined;
QueryBuildFieldList qbfl;
Map fieldMapping;
q = new Query();
qbds = q.addDataSource(tableNum(SalesTable));
qbds.addSelectionField(fieldNum(SalesTable,SalesId));
qbds.addRange(fieldNum(SalesTable,SalesStatus)).value('3');
qbfl = qbds.fields();
qbfl.dynamic(QueryFieldListDynamic::No);
qbds_Joined = q.dataSourceTable(tableNum(SalesTable)).addDataSource(tableNum(XDSCustTable));
qbds_Joined.addSelectionField(fieldNum(XDSCustTable,UserId));
qbds_Joined.addLink(fieldNum(SalesTable,InvoiceAccount),fieldNum(XDSCustTable,CustAccount));
qbds_Joined.addRange(fieldNum(XDSCustTable,UserId)).value('TestUser');
fieldMapping = new Map(Types::String,Types::Container);
ttsBegin;
fieldMapping.insert(fieldStr(XDSSalesTable,SalesId) ,[qbds.uniqueId(),fieldStr(SalesTable,SalesId)]);
fieldMapping.insert(fieldStr(XDSSalesTable,UserId) ,[qbds.uniqueId(),fieldStr(XDSCustTable,UserId)]);
Query::insert_recordset(xDSSalesTable,fieldMapping,q);
qbds_Joined = q.dataSourceTable(tableNum(SalesTable)).addDataSource(tableNum(XDSCustTable));
qbds_Joined.addSelectionField(fieldNum(XDSCustTable,UserId));
qbds_Joined.addLink(fieldNum(SalesTable,InvoiceAccount),fieldNum(XDSCustTable,CustAccount));
qbds_Joined.joinMode(JoinMode::ExistJoin);
qbds_Joined.addRange(fieldNum(XDSCustTable,UserId)).value('TestUser');
private void filterByDimensionFocus(DimensionAttributeValueCombination _dimensionFocus)
{
...
Query dimensionQuery = new Query(queryStr(AccountingSourceExplorerQuery));
...
QueryBuildDataSource qbdsGeneralJournalAccountEntry = dimensionQuery.dataSourceTable(tableNum(GeneralJournalAccountEntry));
QueryBuildDataSource qbdsDimensionAttributeValueCombination = dimensionQuery.dataSourceTable(tableNum(DimensionAttributeValueCombination));
qbdsDimensionAttributeValueCombination.joinMode(JoinMode::InnerJoin);
...
Query::insert_recordset(generalJournalAccountEntryTmp, fieldMapping, dimensionQuery);
...
}
The error 'Invalid source query specified for insert_Recordset'
occurs because insert_recordset
does not support complex queries with joined tables or linked data sources. The insert_recordset
command expects a query with a single data source, so adding a joined data source (qbds_Joined
) in this case is invalid.
select
statement instead of insert_recordset
for inserting records with joined conditions.XDSSalesTable
.SELECT SalesId FROM SalesTable(SalesTable_1)
WHERE (((SalesStatus == "3"))
EXISTS JOIN *FROM XDSCustTable(XDSCustTable_1)
where((UserId = N'TestUser'))}
((SalesStatus == "1") ||(SalesStatus == "3"))
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156