Announcements
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,
Yes
You are right
Thank you
Great! Please mark the helpful answer(s) as Verified, which is done by choosing Did this answer your question > Yes.
Thanks it works
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.
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()); }
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 :
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.
André Arnaud de Cal...
293,289
Super User 2025 Season 1
Martin Dráb
232,064
Most Valuable Professional
nmaenpaa
101,156
Moderator