Dear Dynamics community,
I could use your assistance completing an issue I'm having when attempting to load a temporary in-memory table from a List.
The behavior that I've noticed is that when I set the temporary table I'm only able to load a single object from the list; when I attempt to load multiple objects an error is thrown (as I would expect the List to be dynamic, and more than two objects in the list will typically be expected). Is there a method or process where I might load multiple objects of the same type into a temporary table on which to perform a select from?
Currently my code is set up as follows:
private BRKContractHeader finalListReduction(List contracts) { BRKContractHeader bestContract; BRKContractLine bestContractLine; BRKShippingScenario bestShippingScenario; bestContract.setTmp(); ListEnumerator enumerator = contracts.getEnumerator(); while(enumerator.moveNext()) { BRKContractHeader header = enumerator.current(); bestContract.setTmpData(header); bestContract.doInsert(); }
Furthermore the method continues and I attempt a 'select' against the existing information I expect to be loaded into the temp table:
select bestContract join bestContractLine join bestShippingScenario order by bestContract.ContractId desc , bestContractLine.ContractLine desc , bestShippingScenario.ShippingScenarioLine desc where bestContract.ContractId == bestContractLine.ContractId && bestContract.ContractId == bestshippingScenario.ContractId && bestContractLine.ContractLine == bestShippingScenario.ContractLine && bestContractLine.FreightResponsibility == BRKFreightResponsibility::DJJ { bestContract = bestContract; } return bestContract; }
Ideally I would like to be able to load multiple records into the header table, find the corresponding line and shippingScenarios information, in order to whittle down the list to where only a few (ideally one) contract would remain.
Your help, as always, is much appreciated. Happy St. Valentine's Day to you all!