AX 2009 Dialog

hi

i want to create a dialog that accepts a table name from the user. then i want to execute an sql statement with the table name based on the input. is there a way to do that? thanks.

static void testDialog(Args _args)

{

Dialog dialog = new Dialog(“Test”);

Dialogfield df;

df = dialog.addField(typeid(TableName));

if (dialog.run())

{

select * from [insert table name here]

}

}

i cant seem to pass the dialog input value into my sql statement. any ideas would be welcome. thanks

Hi, see the following solution:

``

TableId tableId;
Common common;
;
tableId = pickTable();
if (tableId)
{
    common = new DictTable(tableId).makeRecord();
    select count(RecId) from common;
}

Hi Martin,

is there a way to change pickTable(i) into a Dialog so it can accept user input?

thanks

Hi, it can be changed (it is placed in Global class in AOT), however you can also use your dialog - I used pickTable() to simply show another approach, which may not be ideal in your case.