First, create a method like the following either on your Report element or in the relevant Section. display str 30 barcodeRefNum() { Barcode barcode; ; barcode = Barcode::construct(BarcodeType::Code128); barcode.string(true, custPackingSlipJour.packingSlipId); return barcode.barcodeStr(); } Note the BarcodeType enumeration that provide you with options other than 128. Then, add a String control … Continue reading ax / d365fo – Adding Barcode to a Report
AX / D365FO – How to : “The class or interface does not exist ax”
Are trying to use a class that belongs to another model and you face this error : "The class or interface .... does not exist" Don't worry this happens because you forgot to reference the model in your custom model. To solve the issue follow these steps : Go to Dynamics 365 > Model management … Continue reading AX / D365FO – How to : “The class or interface does not exist ax”
AX / D365FO – How to clear a date field in X++
To clear a date just use datenull() method SalesParam.TransDate = datenull();
SQL Server – Row Count for all Tables in a Database
Are you loiking for a SQL SERVER query that gives you an overview of how many row has every single database table? Look a this SELECT QUOTENAME(SCHEMA_NAME(sOBJ.schema_id)) + '.' + QUOTENAME(sOBJ.name) AS [TableName] , SUM(sPTN.Rows) AS [RowCount] FROM sys.objects AS sOBJ INNER JOIN sys.partitions AS sPTN ON sOBJ.object_id = sPTN.object_id WHERE sOBJ.type = 'U' AND … Continue reading SQL Server – Row Count for all Tables in a Database
AX / D365FO – Group by and Aggregate functions on select statement
Thiis simple code shows how to do a Query using a select statement with GROUP BY clause and Aggregate functions like COUNT, SUM, AVG, etc.. CustTable custTable; while select count(RecId), CustGroup from custTable group by CustGroup order by custTable.RecId desc { info(strFmt("%2 - %1", custTable.RecId, custTable.CustGroup)); }
SQL SERVER – Format numbers in SQL Server
Nice post that describes how to use SQL SERVER function to format numbers : https://www.mssqltips.com/sqlservertip/7021/sql-format-number/
SQL SERVER – Format Dates with FORMAT Function
Nice post that describes how to fomat dates in SQL SERVER https://www.mssqltips.com/sqlservertip/2655/format-sql-server-dates-with-format-function/
SQL SERVER – COnvert Datetime to Date
This simple script Convert current datetime to Date removing hours, minutes, seconds SELECT CONVERT(DATE,GETDATE()) -- Convert current datetime to Date removing hours, minutes, seconds
SQL SERVER – Add or remove days to a Date
Add or remove days to a date SELECT DATEADD(DAY, -1, GETDATE()) --Remove 1 day to current date SELECT DATEADD(DAY, 1, GETDATE()) --Add 1 day to current date
SQL SERVER – Automatically Defrag indexes based on a given fragmentation percent
This script performs a reorganization of the indexes of the tables that have a percentage of fragmentation greater than a number that you can decide DECLARE @sqlCommand nvarchar(max) SELECT @sqlCommand = string_agg( CONVERT(NVARCHAR(max) ,'ALTER INDEX ALL ON ' + T.name + ' REORGANIZE'), ';' ) FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS DDIPS INNER … Continue reading SQL SERVER – Automatically Defrag indexes based on a given fragmentation percent