Use of ‘like’ in a if-statement

  • October 13, 2009
  • 1 Comment

In Ax it is possible to use the ‘like’ keyword in a if-statement. This would look like this: 1 2 3 4 if (purchTable.purchId like ’09*’) { // Do something }if (purchTable.purchId like ’09*’) { // Do something }

Using ‘Not Like’ in Ax X++

  • October 13, 2009
  • 0 Comments

When you want to use wild-cards in Ax, you can write a SQL statement with a LIKE keyword 1 2 select firstonly purchTable where purchTable.purchId like ’09*’;select firstonly purchTable where purchTable.purchId like ’09*’; When you want to have all the other records (not like), in X++ SQL-statements you have 3 possibilities: 1.!LIKE : 1 2 … Continue Reading

XML parser namespace error

  • September 9, 2009
  • 1 Comment

Today I tried to create the following XML-structure in Ax: 1 2 <?xml version="1.0" encoding="UTF-8"?> <personen xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Personeel.xsd"><?xml version="1.0" encoding="UTF-8"?> <personen xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Personeel.xsd"> I wrote the following to do so: 1 2 3 4 xmlDoc = WGKFunctions::createXMLDocumentWithDeclaration(#version, #encoding, #standalone); root = xmlDoc.createElement(this.rootNode()); … root.setAttribute("xsi:noNamespaceSchemaLocation", "Personeel.xsd");xmlDoc = WGKFunctions::createXMLDocumentWithDeclaration(#version, #encoding, #standalone); root = xmlDoc.createElement(this.rootNode()); … … Continue Reading

Internal Error Number 25 in script occurs

  • August 12, 2009
  • 1 Comment

When you modify the info.reportsendmail() in Ax2009 so it won’t send mails trough SysINetMail, but trough the SysMailer you could get the following error: ‘Internal Error Number 25 in script’. The same error occures when you try to post an invoice to a e-mail message. There is a hotfix for Microsoft Dynamics Ax 2009 SP1 (KB973902) … Continue Reading

Add leading zeros

  • July 31, 2009
  • 1 Comment

You want to show a integer with a fixed length (for example 2characters: 1 –> 01). You don’t have to write your own for-loop to ad the zero’s in front or something like that. The function strRFix does this for you automaticly. 1 info(strRFix(int2str(1), 2, ‘0’));info(strRFix(int2str(1), 2, ‘0’)); Note: there is also a strLFix…

About labels

  • July 31, 2009
  • 0 Comments

In Ax there is a class called SysLabel. When you want to expiriment with labels, this is the place to be. Some examples: You want to find a label in a specific language. There are a few ways to do this, for you to chos witch fits best. 1 2 3 4 5 // Method … Continue Reading

Select a record from a table when you only have the tableId

  • July 16, 2009
  • 1 Comment

The following code can provide you a generic way to update a table when you only have the tableId. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 public Common findRecord(TableId _tableId, RecId _recId, Boolean _forUpdate = false) { Common      common; DictTable   dictTable; ; dictTable = new DictTable(_tableId); common … Continue Reading

Using FilePath on a form

  • June 25, 2009
  • 1 Comment

When you want a filebrowser on your form and you only added a field that extends from the Extended Data Type FilePath, you wil get a stack-trace/error message when you click on the folder icon. Don’t panic, there is nothing wrong with your AX. Like the error explains you just need to provide the form … Continue Reading

Changing AOT properties from code

  • June 23, 2009
  • 0 Comments

When you want to it is possible to change AOT properties from code. The first you need to do, is finding the treenode you want to modify: 1 2 3 4 5 #AOT #Properties TreeNode node = TreeNode::findNode(#TablesPath); ; node = node.AOTfindChild("SysUserInfo");#AOT #Properties TreeNode node = TreeNode::findNode(#TablesPath); ; node = node.AOTfindChild("SysUserInfo"); When you want to … Continue Reading

Working with numbersequences – new NumberSequence

  • May 5, 2009
  • 1 Comment

When you want to create a new NumberSequence in AX you have to do the following steps: 1. Create a new Extended Data Type (EDT). Often this EDT extends from num. (this step is not mandatory, but it is a best practice) 2. Discide in witch module this new Number Sequence Reference (classes NumberSeqReference_…) should … Continue Reading