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, ...
Answered

adding a temp table to to form

(0) ShareShare
ReportReport
Posted on by 5

Hello team,

I'm trying to display a temp table that I have added to the data source of a form. The temp table has three fields that I want to display  

in the grid of the form.  I'm using a class 'rtiFillDueDateBeforeInvoiceTemp to fill the temp table like this: 

'

public class rtiFillDueDateBeforeInvoiceTemp
{
CustInvoiceJour custInvoiceJour ;

DueDateBeforeInvoiceTmp dueDateBeforeInvoiceTmp ;

}

public DueDateBeforeInvoiceTmp fillTmpData()
{
ttsbegin;
while select custInvoiceJour

where custInvoiceJour.DueDate < custInvoiceJour.InvoiceDate

{

dueDateBeforeInvoiceTmp.InvoiceId = custInvoiceJour.InvoiceId;
dueDateBeforeInvoiceTmp.DueDate = custInvoiceJour.DueDate;
dueDateBeforeInvoiceTmp.InvoiceDate = custInvoiceJour.InvoiceDate;

dueDateBeforeInvoiceTmp.insert();

//insertList.add(tmpInventTable);

}

//insertList.insertDatabase();
ttscommit;
return dueDateBeforeInvoiceTmp;


}

and this is my init method in the form : 

public class FormRun extends ObjectRun
{

CustInvoiceJour custInvoiceJour ;

DueDateBeforeInvoiceTmp dueDateBeforeInvoiceTmp ;

rtiFillDueDateBeforeInvoiceTemp rtiFillDueDateBeforeInvoiceTemp;

}

public void init()
{
super();

// dueDateBeforeInvoiceTmp.setTmpData(dueDateBeforeInvoiceTmp ::getTmpData());

rtiFillDueDateBeforeInvoiceTemp = rtiFillDueDateBeforeInvoiceTemp::construct();




//   rtiFillDueDateBeforeInvoiceTemp.fillTmpData();

dueDateBeforeInvoiceTmp.setTmpData(rtiFillDueDateBeforeInvoiceTemp.fillTmpData());

}

and when I try to open the form, it is showing an empty grid with no records. Someone can help me with this?

Best ragards, 

I have the same question (0)
  • Martin Dráb Profile Picture
    237,959 Most Valuable Professional on at

    Which type of temporary table are you using?

    What did you find when you debugged your code?

    Also, please post your code with line indentation - it'll be much easier to read for us. Use Insert > Code (in the rich formatting view) to paste your code.

  • OussamaF Profile Picture
    5 on at

    Hey Martin,

    I'm using an in-memory temp table.

    When I'm debugging, it's going through the loop that is supposed to fill the temp table, then the temp table is returned where it is called in the init() method form.

    but when I open the form it's showing an empty grid with no records.

    here is my code in the form  :

    public class FormRun extends ObjectRun
    {
    
        CustInvoiceJour custInvoiceJour  ;
        DueDateBeforeInvoiceTmp  dueDateBeforeInvoiceTmp  ;
        rtiFillDueDateBeforeInvoiceTemp  rtiFillDueDateBeforeInvoiceTemp;
    
    
    }
    public void init()
    {
        super();
    
       rtiFillDueDateBeforeInvoiceTemp = rtiFillDueDateBeforeInvoiceTemp::construct();
       
       dueDateBeforeInvoiceTmp.setTmpData(rtiFillDueDateBeforeInvoiceTemp.fillTmpData());
        
    
    }
    
    

    and that's my code in the class that has the filling temp table method 

    public class rtiFillDueDateBeforeInvoiceTemp
    {
        CustInvoiceJour custInvoiceJour  ;
        DueDateBeforeInvoiceTmp  dueDateBeforeInvoiceTmp  ;
    
    }
    
    public  DueDateBeforeInvoiceTmp fillTmpData()
    {
        
       //  RecordInsertList insertList = null;
        // insertList = new RecordInsertList(tablenum(DueDateBeforeInvoiceTmp));
    
        
        ttsbegin;
         while select  InvoiceId, DueDate, InvoiceDate from custInvoiceJour
    
            where custInvoiceJour.DueDate < custInvoiceJour.InvoiceDate ;
    
        {
    
                dueDateBeforeInvoiceTmp.clear(); 
                dueDateBeforeInvoiceTmp.InvoiceId = custInvoiceJour.InvoiceId;
                dueDateBeforeInvoiceTmp.DueDate =  custInvoiceJour.DueDate;
                dueDateBeforeInvoiceTmp.InvoiceDate = custInvoiceJour.InvoiceDate;
    
                dueDateBeforeInvoiceTmp.insert();
    
          //   insertList.add(dueDateBeforeInvoiceTmp);
    
        }
    
       //  insertList.insertDatabase();
        ttscommit;
        return dueDateBeforeInvoiceTmp;
    
    
    }

    This is what is showing : 

    DueDateFormGridEmpty.PNG

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi OussamaF,

    You have declared the temp Table in the class declaration, which you won't need. You should have this table in the form data source as well which you can use. If the name of the data source is DueDateBeforeInvoiceTmpDS, for an example, your init method will look Like this -

    public void init()
    {
        super();
    
       rtiFillDueDateBeforeInvoiceTemp = rtiFillDueDateBeforeInvoiceTemp::construct();
       
       dueDateBeforeInvoiceTmpDs.setTmpData(rtiFillDueDateBeforeInvoiceTemp.fillTmpData());
        
    
    }

  • Verified answer
    Martin Dráb Profile Picture
    237,959 Most Valuable Professional on at

    I see you put a data to a variable, not to the data source. It seems that your variable gets successfully populated, but it has nothing to do with what's displayed in the form.

    Remove dueDateBeforeInvoiceTmp variable from your form and use the name of your form data source instead.

    By the way, what it the reason for using a temporary table? You could apply the filter (DueDate < InvoiceDate) directly to CustInvoiceJour used as a form data source.

  • OussamaF Profile Picture
    5 on at

    Thanks it works

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Great! Please mark the helpful answer(s) as Verified, which is done by choosing Did this answer your question > Yes.

  • OussamaF Profile Picture
    5 on at

    Yes

    You are right

    Thank you

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 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans