Table control help

Hi,

I have created a form and placed a table control on it. In the run method of the form, I fill in the rows and columns with data from a query. when the form comes up, the table is not there. I have checked all the properties (visible, enabled, width, height…etc…) and they are all set correctly. I have stepped through the run procedure and there is data there and it runs without error. This is simple, … I used the tutorial_form_table as a guide yet I still can’t see the table. What am I doing wrong? Code is below:

public class FormRun extends ObjectRun
{
SalesTable ST;
CustTable CT;
}

public void run()
{
int col=1;
int row=1;
;
WHILE SELECT FirstOnly10 ST order by SalesID ASC
WHERE ST.SalesStatus == SalesStatus::Backorder
JOIN CT WHERE ST.CustAccount== CT.AccountNum
{

tbl.cell(col,row).data(ST.SalesId);
col++;
tbl.cell(col,row).data(ct.Name);
col++;
tbl.cell(col,row).data(ST.ReceiptDateRequested);
col++;
tbl.cell(col,row).data(ST.ReceiptDateConfirmed);
row++;
col=1;

}
tbl.visible(true);

super();
}

I don’t get it… I am running it by right clicking the form in the AOT and selecting 'Open"… I assume that is ok to test.
Any insight would be appreciated.

Thanks,
Chris

You have to override the “editControl” method on the actual table control itself.

If you’re just getting started with AX…I wouldn’t use the table control. Table control would be for some pretty special requirements. It’s neat, but not commonly used.

Thanks Alex. I am using the table control because of the way I will need to get the data. I am fairly new to AX programming, but have been programming in .net for years. The SQL commands and structure is just very screwy to me vs. normal .net datasets/queries. And I don’t think I can get all the data from multiplie queries into a single datasource in AX (like I could in .net)… but this is the issue with being a newbie. I would like to just use the grid control, but it doesn’t look like I can add rows to it in a loop like I can with the table control.

All that said, I don’t understand why I need to override the editcontrol method when I don’t want the control to be editable. I have nothing to write in the edit control mehtod… am I more lost than I thought?

And thank you very much for taking the time to reply.

Chris

Chris,

I 100% understand where you’re at. When I first started programming in AX from a .Net background, the concepts were the strangest to learn. Logically, you want to use an object (table/grid) and fill it with data as the form runs. This isn’t typical of AX. Is the data you are trying to display in AX?

You will have better luck by either writing a good query that can pull the data, or creating a table (or temp table) in the AOT with the necessary fields, add it as a datasource to your form, then you can fill/truncate as needed, then refresh the datasource after filling.

A table control would be used for a very specific purpose by somebody very experienced in AX who knows that it is the only way to accomplish what they need. I’ve been programming for some years now, and have yet to have a good reason to use a table control.

Alex

Thanks again Alex for the response and design advice. I’ll try your table approach and just use the grid. Much appreciated.

Best Regards,

Chris