I have one function in which I want to add 3 rows to an InMemory table buffer and then return it (it is used in a setTempData call to be set as the datasource for a grid)
The third row is calculated by differences between the first two rows.
hourTotals.Hourtype = HourType::Registered;
hourTotals.insert();
hourTotalsPlanned.data(hourTotals.data());
hourTotalsPlanned.insert();
select firstonly * from hourTotalsPlanned where hourTotalsPlanned.HourType == FM_HourType::Planned;
hourTotals.Maandag = hourTotalsRegistered.Maandag - hourTotalsPlanned.Maandag;
The last line creates a stackOverFlowException. This is probably the case because the 3 table buffers still refer to each other.
My goal is to store the data of the first two rows in another variable, so I can calculate the third row, also insert it into the original hourTotals buffer and then return it.
SECOND TRY:
I also tried replacing the data() calls by using buf2Buf(hourTotals, hourTotalsRegistered), but this gives the same problem.
THIRD TRY:
I also tried using insert_recordset, but this also gives the same error at the same line:
FM_HourTotals hourTotalsPlanned;
insert_recordset hourTotalsPlanned(Maandag, Dinsdag, Woensdag, Donderdag, Vrijdag, Zaterdag, Zondag, Totaal, HourType)
select firstonly Maandag, Dinsdag, Woensdag,Donderdag, Vrijdag, Zaterdag, Zondag, Totaal, HourType
from hourTotals where hourTotals.HourType == FM_HourType::Planned;
How would I go about doing this?