Create Table Browser in D365 Finance and operations
Sometimes we might have to see the data in the tables, but as we know in case 0f cloud implementation of d365 finance and operations we do not have access to SQL server on production environment. Hence, we can not get from SQL. There was another option in AX 2012 R2 & AX 2012 R3, which is table browser. This option is not available on D365 finance and operation to check data from client, it is available from Visual Studio.
This can be developed in D365 Finance and operations. Please follow below steps to create custom table browser:
1. Create a new form to project.
2. In the design apply custom pattern and content as shown in below image
3. Once you add String control table name and button Table browser, override the lookup method of TableName to give lookup from SQLDictionary table.
4. Then override the clicked method of TableBrowser to open the table browser for the table provided in TableName control.
5. Please find the code below for both the methods.
• Lookup method of TableName String control
public void lookup()
{
Query query;
QueryBuildDataSource qbds;
SysTableLookup lookup;
super();
query = new Query();
qbds = query.addDataSource(tableNum(SqlDictionary));
lookup = SysTableLookup::newParameters(tableNum(SqlDictionary), this);
qbds.clearRanges();
qbds.addRange(fieldNum(SqlDictionary,fieldId )).value('0');
lookup.addLookupfield(fieldNum(SqlDictionary, Name));
lookup.addLookupfield(fieldNum(SqlDictionary, SqlName));
lookup.parmQuery(query);
lookup.performFormLookup();
}
• Clicked method of TableBrowser button control
public void clicked()
{
SysTableBrowser sysTableBrowser;
str tName;
super();
tName = TableName.valueStr();
if (!tName)
{
throw error(strfmt("@ApplicationFoundation:SysTableBrowser_MissingTableName"));
}
sysTableBrowser = new SysTableBrowser();
sysTableBrowser.parmTableName(tName);
sysTableBrowser.run(tablename2id(tName));
}
6. Once the form is ready, create menuitem of the form and attach to menu.
7. Find screenshots below:
You can then export that data to excel through standard export to excel feature.



No comments:
Post a Comment