Tuesday, December 22, 2020

AX - How to read name from product

InventTable inventTable;

inventTable = InventTable::find( InventQuarantineOrder.itemId );
if ( !inventTable ) return false;
...
sText += inventTable.productName( SystemParameters::getSystemLanguageId() );

Friday, December 18, 2020

C# - How to convert short array/list into byte array list

/* source with short values */
public List<short> Data = new List<short>();
...
short[] DataArray = Data.ToArray();
byte[] bufferBytes = new byte[ DataArray.Length * sizeof( short ) ];
Buffer.BlockCopy( DataArray, 0, bufferBytes, 0, bufferBytes.Length );
      
/* dest with byte values */      
Console.WriteLine( bufferBytes[0] + ", " + bufferBytes[1] );
If first short value in source list is 313, then first two values in bufferBytes after copy will be 57 (111001) a 1(1).