Creating form with tempdb as datasource

I’m not sure what I have done wrong but I can’t seem to get my new form grid filling up.

Here is what I have

Form:

TCI_Address_Book

Table:

TCI_Address_Booktmp (tempdb)

I added some fields to the temptable

Then I added the temptable to the datasource of the form

I then added a grid to the form

Then I dragged some fields from the datasource of the form into the grid

I then created a method called populateRecords on the form:

public TCI_Address_Booktmp populateRecords()
{
HcmWorker hcmWorker;
DirPartyTable dirPartyTable;
DirPartyLocation dirPartyLocation;
LogisticsPostalAddress lpa, lpa2;
LogisticsElectronicAddress lea, lea2;
TCI_Address_Booktmp tmpTable;

while select hcmWorker
where hcmWorker.PersonnelNumber == ‘5187’
join dirPartyTable
where dirPartyTable.RecId == hcmWorker.Person
join dirPartyLocation
where dirPartyLocation.Party == dirPartyTable.RecId
join lpa
where lpa.Location == dirPartyLocation.location
join lea
where lea.RecId == dirPartyTable.PrimaryContactPhone
join lea2
where lea2.RecId == dirPartyTable.PrimaryContactEmail
{
tmpTable.Name = dirPartyTable.Name;
tmpTable.PersonnelNumber = hcmWorker.PersonnelNumber;
tmpTable.insert();
}

return tmpTable;
}

And I updated the forms init method:

public void init()
{
super();

TCI_Address_Booktmp.linkPhysicalTableInstance(element.populateRecords());
}

When I open the form, and I put a breakpoint on populate records, it works correct and I’m getting records but nothing is showing up in the grid. Can someone help me?

Check the data source property of the grid.
Try moving you code to a class or table and try converting it into a set based operation. (though this is not the cause of your actual issue).

Yup, that did it! Thanks