recordCount =
sysquery::countTotal(query);
This blog is about Dynamics AX articles and tricks. Anil Ozay is a MCITP,MCTS and MCP. Also he was Dynamics AX MVP (2006 and 2007).
Wednesday, January 30, 2013
Get new number from number sequence
NumberSequenceReference
numberSequenceReference;
NumberSeq numberSeq;
;
NumberSequenceReference
=
numberSequenceReference::find(typeId2ExtendedTypeId(typeid(SalesId)));
numberSeq =
NumberSeq::newGetNum(NumberSequenceReference,true);
this.SalesId = numberSeq.num();
Current empl id and sales unit of employee in AX
SmmUtility::getCurrentContact(); // current empl id
SmmUtility::getCurrentSalesUnit(); // sales unit of current employee !
SmmUtility::getCurrentSalesUnit(); // sales unit of current employee !
Record count of tables in AX
Sometimes we need to track the record counts of tables in AX. The fastest way is creating a query in SQL Server Management Studio.
USE Dynamics
GO
SELECT
OBJECT_NAME(OBJECT_ID) TableName, st.row_count
FROM
sys.dm_db_partition_stats st
WHERE index_id <
2
ORDER BY
st.row_count DESC
GO
Recalculate InventSum
InventSum is needed to recalculate sometimes.We should use InventSumRecalcItem class in Dynamics AX.
Sample Code :
// CODE BEGIN ****************************
InventSumRecalcItem InventSumRecalcItem;
;
InventSumRecalcItem = new InventSumRecalcItem("ITEM001", true, checkfix::fix);
InventSumRecalcItem.updatenow();
// CODE END ******************************
First parameter : ItemId
Second parameter : Show errors
Third parameter : Fix or only check
If you want to calculate for all items :
// CODE BEGIN ****************************
InventTable InventTable;
InventSumRecalcItem InventSumRecalcItem;
;
WHILE SELECT InventTable
WHERE (InventTable.ItemType == ItemType::Item) || (InventTable.ItemType == ItemType::BOM)
{
InventSumRecalcItem = new InventSumRecalcItem(InventTable.ItemId, true, checkfix::fix);
InventSumRecalcItem.updatenow();
}
// CODE END ******************************
Sample Code :
// CODE BEGIN ****************************
InventSumRecalcItem InventSumRecalcItem;
;
InventSumRecalcItem = new InventSumRecalcItem("ITEM001", true, checkfix::fix);
InventSumRecalcItem.updatenow();
// CODE END ******************************
First parameter : ItemId
Second parameter : Show errors
Third parameter : Fix or only check
If you want to calculate for all items :
// CODE BEGIN ****************************
InventTable InventTable;
InventSumRecalcItem InventSumRecalcItem;
;
WHILE SELECT InventTable
WHERE (InventTable.ItemType == ItemType::Item) || (InventTable.ItemType == ItemType::BOM)
{
InventSumRecalcItem = new InventSumRecalcItem(InventTable.ItemId, true, checkfix::fix);
InventSumRecalcItem.updatenow();
}
// CODE END ******************************
Labels:
AX 2009,
Calculate,
Dynamics AX,
English,
InventSum
Subscribe to:
Posts (Atom)