How to order form grid by field that is not included in the data source

So this can be done by updating a query method init of the data source on which grid is based:

 

 QueryBuildDataSource qbds;
 QueryBuildDataSource qbds2;
 //...
 QueryBuildDataSource qbdsn;

 super();
//original data source
qbds = DataSource_ds.query().dataSourceTable(tableNum(DataSourceTable));
 

 qbds2 = qbds.addDataSource(tableNum(OtherTable));
 qbds2.addLink(fieldNum(DataSourceTable,RecId),fieldNum(OtherTable,DataSourceTableRecId));
//...
 qbdsn = qbdsn-1.addDataSource(tableNum(OtherTableN));
 qbdsn.addLink(fieldNum(OtherTableN-1,Recid),fieldNum(OtherTableN,OtherTableN-1Recid));
 qbdsn.addSortField(fieldNum(OtherTableN, FieldYouWantToSortOn));
Advertisements

Manually order record in the form grid

You know those kind of forms where you can use buttons to order records in the right position?

It is quite easy to replicate. It won’t work for all solutions though,

Example of the standard code is a WHSLocDirTable form.

To implement this solution you would have to make changes to the source table ( Add additional field, index, field group , methods for update , insert and delete, as well as moving logic,)

add changes to the the form ( additional field, buttons for up and down and related code, as well as make changes to init method of the form ( to sort by position) and some changes that will have to be implemented on the data source. )

 

 

Debugging on server is impossible, but yet is required

If you have faced the similar situation using Microsoft Dynamics AX, do not worry as there are few solutions that may help you. Sometimes there are even less time consuming than the debugging in server itself.

One of the most favourite ones is to enter all data in the file, and than be able to trace necessary data. you Can find example below

 AsciiIo file;
 FileName fileName;
 FileIoPermission perm;
 container conTextLine;


 fileName = @"\\c:\temp\sometext.txt";

perm = new FileIoPermission(fileName, 'W');

perm.assert();

file = new AsciiIo(fileName, 'W');

//super smart code that needs debuggin
 file.writeRaw("Super  secret value to export");
//some other code

file.finalize();
 file = null;

Example of the lookup.

When you have to create lookup and don’t know all details by heart, this example proves to be really useful. It was found somewhere in the Internet, so if you know where it is taken from please comment and I will link to the author blog post.

 

Query query = new Query();
 QueryBuildDataSource qbds;
 QueryBuildDataSource qbdsJoin;
 SysTableLookup sysTableLookup = sysTableLookup::newParameters( tableNum(VendTable), this);
 ;
 
 qbds= query.addDataSource( tableNum(VendTable));
 qbdsJoin= qbds.addDataSource( tableNum(DirPartyTable));
 qbdsJoin.relations( false);
 qbdsJoin.fields().dynamic(NoYes::Yes);
 qbdsJoin.addLink( fieldNum(VendTable, Party), fieldNum(DirPartyTable, RecId));
 qbdsJoin.joinMode(JoinMode::InnerJoin);
 
 sysTableLookup.parmQuery(query);
 sysTableLookup.addLookupfield( fieldNum(VendTable, AccountNum), true);
 sysTableLookup.addLookupfield( fieldNum(VendTable, VendGroup), true);
 sysTableLookup.addLookupfield( fieldNum(VendTable, Party));
 sysTableLookup.performFormLookup();

Reporting services issue. An error occurred while executing OnInit: The report execution failed to start. Verify that Report Extensions have been installed or are configured correctly. Please consult your administrator or the documentation. (rsErrorInOnInit)

I’ve set up reporting services and they didn’t worked.

Following errors appeared when I tried to deploy something or even simply open reports:

An error occurred while executing OnInit: The report execution failed to start. Verify that Report Extensions have been installed or are configured correctly. Please consult your administrator or the documentation. (rsErrorInOnInit)

What helped me was modification of reporting configuration files.

More details here: https://technet.microsoft.com/EN-US/library/hh389762.aspx

AOTfirstChild() doesn’t work on project

When running this code AOTFirstChild is not selected:

ProjectNode projectNode = SysTreeNode::getSharedProject().AOTfindChild('new');
 projectnode = projectNode.AOTfirstChild();
 if (projectNode)
 info ('yes');

If we add the .LoadForInspection we are able to select the project first child using AOTFirstChild on the project:

ProjectNode projectNode = SysTreeNode::getSharedProject().AOTfindChild('new');
 projectNode = projectNode.loadForInspection();
 projectnode = projectNode.AOTfirstChild();
 if (projectNode)
 info ('yes');

Use loadForInspection to get inside a AOT project.

Blank error starting AX 2012 R3.

What to do when you open AX R3 CU9 and see this beauty. Empty error description.

Captureblank

The issue appeared due to difference in AX versions that were used for database (R3 CU10), and AOS (R3 CU8) .

Solution for this problem is to renew an AOS and client

You can ensure that you have the issue by finding issue description in the event viewer:

Object Server 01:  Fatal SQL condition during login. Error message: "The internal time zone version number stored in the database is higher than the version supported by the kernel (9/8). Use a newer Microsoft Dynamics AX kernel."