A few things you should know about temporary tables

  • May 10, 2010
  • 2 Comments

How do you set a table temporary: You can set the property ‘temporary’ in the AOT to yes –> this table is always temporary You can declare a buffer of a table and call the method setTemp() or setTempData(), from that moment on the buffer contains temporary data. CustTable custTable; ; custTable.setTmp(); if (custTable.isTmp()) { … Continue Reading

The Ax Infolog

  • May 7, 2010
  • 0 Comments

Wel all know the small dialog that gives the user usefull information about what is happening in Ax. In this post I will tell u some more about this. You can add information to the Infolog by calling: Infolog.add(…) info(…) warning(…) or checkfailed(…) error(…) You can add some structure in it by using setPrefix(…) Using … Continue Reading

Execute a job on data in several companies – part2

  • April 30, 2010
  • 1 Comment

In one of my previous posts I explained that you can switch company with the keyword changecompany. I also made a remark that you should set the value of your table-value to null after each changecompany. Small code example (bad): 1 2 3 4 5 6 7 8 9 10 11 12 DataArea dataArea; PurchTable … Continue Reading

Crosscompany

  • April 30, 2010
  • 0 Comments

Yesterday I talked about executing code/getting records in several companies. Now the changecompany is not the only method. You can also get data out of several companies by using the keyword crosscompany in your select statement. Example: 1 2 3 4 5 6 7 8 9 Address address; container conCompanies = [ ‘cee’, ‘dat’ ]; … Continue Reading

Execute a job on data in several companies

  • April 29, 2010
  • 2 Comments

There is a verry simple trick to loop through some companies and execute some code in them. Just write: DataArea dataArea; ; while select dataArea where !dataArea.isVirtual { changecompany(dataArea.id) { // Do Something… } }DataArea dataArea; ; while select dataArea where !dataArea.isVirtual { changecompany(dataArea.id) { // Do Something… } } Note! Make sure that you … Continue Reading

Batch job performance boost

  • April 22, 2010
  • 0 Comments

Did you ever have trouble with the performance of your batch-job? Well maybe this small trick can shorten the time your batch runs. The big idea: Try to split up your gigantic batch in smaller pieces. Launch a batchjob that produces many smaller batchjobs (tasks) that can handle a subset of the data you need to … Continue Reading

Tip for overriding methods

  • April 19, 2010
  • 3 Comments

There is a simple and generic way to force overriding a method you created. To do so you just need create your new method and place a ‘throw error’ statement in it. To finish you can add the static method missingOverride from the error class and the funcName() to your error. Now when this method … Continue Reading

Expressions in query ranges – limitations

  • April 9, 2010
  • 2 Comments

When you want to construct a query-object that contains OR-conditions, you can construct something like this: 1 2 3 4 5 6 queryBuildRange.value(strFmt('((%1 == %2) || ((%1 == %3) && (%4 == "%5")))’, fieldStr(InventTable, ItemType), any2int(ItemType::Service), any2int(ItemType::Item), fieldStr(InventTable, ProjCategoryId), queryValue("Spares")));queryBuildRange.value(strFmt(‘((%1 == %2) || ((%1 == %3) && (%4 == "%5")))’, fieldStr(InventTable, ItemType), any2int(ItemType::Service), any2int(ItemType::Item), fieldStr(InventTable, … Continue Reading

Channel9 : X++ into .Net

  • April 8, 2010
  • 0 Comments

I accidentally found this interesting video about future architecture where you can run X++ in .Net. http://channel9.msdn.com/posts/Charles/Peter-Villadsen-and-Gustavo-Plancarte-Inside-Ax-Translator-X-to-MSIL

Test if a configuration key is enabled in X++ code

  • March 22, 2010
  • 0 Comments

How do you execute code when a Configuration key is enabled? It is pritty easy. Ax x++ has a build-in function ‘isConfigurationKeyEnabled’, witch you can use to check a configuration key. Small example: if (isConfigurationKeyEnabled(configurationkeynum(AIF))) { // Do something… }if (isConfigurationKeyEnabled(configurationkeynum(AIF))) { // Do something… }