Below is the code for getting the unused project dimensions in AX.
Note : Please create a table(Test) with two string fields.
Note : Please create a table(Test) with two string fields.
static void ProjCategory(Args _args)
{
ProjUnpostedTransView projUnpostedTransView;
ProjPostTransView projPostTransView;
CategoryTable categoryTable;
Test test;
int iCounter;
delete_from test;
while select * from categoryTable
{
test.clear();
select firstOnly projPostTransView where projPostTransView.CategoryId == categoryTable.CategoryId;
if(projPostTransView)
{
continue;
}
// else if(!projPostTransView)
// {
select firstonly projUnpostedTransView where projUnpostedTransView. CategoryId == categoryTable.CategoryId;
if(projUnpostedTransView)
{
continue;
}
else
{
test.AccountNum = categoryTable.CategoryId;
test.Name = categoryTable.CategoryName;
test.insert();
iCounter++;
}
SQL Query:
select * from CATEGORYTABLE where not exists
( select * from projPostTransView where CATEGORYTABLE.CategoryId = projPostTransView.CategoryId) and
not exists (select * from ProjLedgerJournalTransUnpostedView where CATEGORYTABLE.CategoryId = ProjLedgerJournalTransUnpostedView.CATEGORYID)
@Rahul Talasila
Super useful post, Rahul! Cleaning up unused project categories in AX 2012 can really streamline system performance and reduce clutter in reports. The combination of X++ code and SQL query makes this easy to implement across environments. For those managing ERP systems like this, choosing the right hosting provider matters too I’d recommend checking out this webspace web hosting option for reliable and scalable performance. Looking forward to more deep-dive posts like this!
ReplyDelete