web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Copying data from one table buffer to another one without having an underlying reference

(0) ShareShare
ReportReport
Posted on by 329
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.
 
I have the following setup:
 
 
 
HourTotals hourTotals;
HourTotals hourTotalsRegistered;
HourTotals hourTotalsPlanned;
 
hourTotals.Maandag = 2;
hourTotals.Hourtype = HourType::Registered;
hourTotals.insert();
 
hourTotalsRegistered.data(hourTotals.data());
hourTotalsRegistered.insert();
select firstonly * from hourTotalsRegistered where hourTotalsRegistered.HourType == HourType::Registered;
 
hourTotals.Maandag = 1;
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?
            
 
 
 
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,130 Super User 2025 Season 2 on at
    Hi Superbunny,
     
    Can you explain the exact functional requirement? What is the source for the registered and planned hour details? What is the exact error message you get?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans