Axapta: How can the Table Name, Not the Table ID, be used as a select in the Select Dialog of the Database Log Report?

StackOverflow https://stackoverflow.com/questions/1366333

  •  21-09-2019
  •  | 
  •  

Question

Currently only the Table Id can be used which is meaningless as it is a number. A little bit of code example would really be great.

Was it helpful?

Solution

Create a new RunBaseReport class and remember to name the SysDatabaseLog report in the lastValueElementName method.

Prompt the table name in the dialog method; use the TableName extended data type to enable lookup.

Object dialog() 
{
    DialogRunbase dlg = super();
    ;
    dialogTableName = dlg.addFieldValue(typeId(TableName),tableId2Name(tableId));      
    return dlg;  
}

Update the table id range of the queryRun.query() in the getFromDialog method after calling super(). Use the tableName2Id function to convert to table id.

boolean getFromDialog()
{
    boolean ret = super();
    ;
    tableId = tableName2Id(dialogTableName.value());
    this.queryrun().dataSourceNo(1).findRange(fieldNum(SysDatabaseLog,Table)).value(queryValue(tableId));
    return ret;
}

In the validate method, validate that table name is valid (table id not 0, table not temp etc.).

Lastly you change the output menu item to point to the class rather than the report.

Warning: code has not been tested!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top