Showing posts with label ax. Show all posts
Showing posts with label ax. Show all posts

Wednesday, January 20, 2016

Export-Import XPO files

Among our AX mundane chores I would highlight the promotion process. Nevertheless, this changed drastically since AX 2012 started using models and model stores; sometimes, the old good way is in demand, yet.

I am talking about promoting your projects between environments via exporting and importing XPO files. First, we export the project from, say, DEV environment to an XPO file. Then we import it to TEST environment with the Definition only option checked. After that we export the current content of this project as a back up. Finally, we re-import the project entirely.

Schematically the process goes as follows:

DEV-MyProject->DEV\MyProject.xpo
TEST<-DEV\MyProject.xpo (definition)
TEST-MyProject->\BackUp\MyProject
TEST<-DEV\MyProject.xpo

Not a big deal when it comes to one-two projects only. Everything changes when you need to cope with a dozen of them... I developed a small class that keeps me lazy by doing all these steps.

You need to set up its parameters for every environment where you need to promote projects.



It reads project names to export-import line by line from a plain text file and processes them one by one.

Note: it works on CUS layer only and without labels; however, it can be easily adapted to your context.

Here is the link to download.

Saturday, October 27, 2012

Alice in Wonderland

Every day my "Alice in Wonderland" adventure starts with Ctrl-D with a little help from my friends from http://axforum.info/

Thank you friends! I am still safe and sound!

Каждый день моё приключение алисы в стране чудес начинается с Ctrl-D при поддержке моих друзей с форума http://axforum.info/

Спасибо, друзья! Я всё ещё цел и невредим!

Tuesday, December 13, 2011

Dates In An Extended Query Range

Let's say we need to range all the BOM versions that are active as of today. For this purpose we can use an extended range in the query.

{
    QueryBuildRange qbr;
    ;
    if(!_args.record())
        return;
    // there is an active caller!
    switch (_args.record().TableId)
    {
        case tablenum(InventTable):
            inventTable = element.args().record();
            this.query().dataSourceTable(tablenum(InventTable)).addRange(fieldnum(InventTable, ItemId)).value(inventTable.ItemId);
            qbr = this.query().dataSourceTable(tablenum(BOMVersion)).addRange(fieldnum(BOMVersion, RecId));
            qbr.value('(fromDate <= '+date2StrXpp(today())+') && (toDate >= '+date2StrXpp(today())+')');
            break;

The final SQL query will look like this (a fragment):


= BOMVersion.ItemId AND ((Active = 1)) AND (((fromDate <=13\12\2011) && (toDate >= 13\12\2011))) JOIN * FROM BOM(BOM_1) ORDER BY BOM.LineNum ASC ON BOMVersion.BOMId = BOM.BOMId

The idea was taken from the AX forum (in Russian).

Monday, July 11, 2011

Paint it black: How to color rows in Table form control

There a lot of answers on how to color grid lines and cells -- for example, this DisplayOption using from DAXGuy. However, my goal is to show how one can paint rows in Table form control. I use the standard tutorial form tutorial_Form_Table from AX2009.

On the table control, we need to change a bit EditControl method where we define in which color the current row will be painted. (Here, I provided you with a link where you can choose RGB colors to paint the hell at your own.)


// Color the active line in a table
FormControl editControl(int column, int row)
{
    #DEFINE.colorDarkTurkoise(112,147,219)                  // colors at your personal perception of hell
    #DEFINE.colorNeonBlue(77,77,255)
    #DEFINE.colorRosyBrown(255,193,193)
    #DEFINE.colorSaddleBrown(139,69,19)
    int oldStrColor = WinApi::RGB2int(#colorRosyBrown);     // colors for cells not in focus
    int oldIntColor = WinApi::RGB2int(#colorSaddleBrown);
    int newIntColor = WinApi::RGB2int(#colorNeonBlue);      // colors for the selected line
    int newStrColor = WinApi::RGB2int(#colorDarkTurkoise);
    ;
    // this is columns with int controls
    if ((column == 2) || (column == 4))
    {
        // not in the header
        if (row > 1)
        {
            // this is in the selected line
            if (row == table.row())
                intEdit.backgroundColor(newIntColor);
            else
                intEdit.backgroundColor(oldIntColor);
            return intEdit;
        }
        // this is the header
        else
        {
            if (row == table.row())
                editline.backgroundColor(newStrColor);
            else
                editline.backgroundColor(oldStrColor);
            return editline;
        }
    }
    else
    {
        if (row == table.row())
            editline.backgroundColor(newStrColor);
        else
            editline.backgroundColor(oldStrColor);
        return editline;
    }

}

So, when the user selects another row, all its controls change their color--it's your responsibility to return the correct form control: StringEdit, IntEdit and so on.

The second method where we redraw the form is activeCellChanged.


public void activeCellChanged()
{
    ;
    super();
    // do not forget to repaint the form!
    element.redraw();
}

Coloring can be realized much more complicated with different color scheme, calculated conditions etc.

Wednesday, September 15, 2010

Microsoft Dynamics Salary Survey 2010

Now, this is the time to participate in the annual Microsoft Dynamics Salary Survey conducted by Nigel Frank International.

It takes actually two minutes to fill in. This is in English, but it is very easy to understand.

As a prize you will get a copy of the survey results, which are a comprehensive analysis of comparative salary data in different aspects: geography, domains, positions and so on. You can see 2009 report here.



Copyright 2009 Nigel Frank International Ltd.

I am sure this job helps us a lot to improve our employment situation. So, please, enjoy!

Monday, February 8, 2010

Error: Multiple calls to CodeAccessPermission.Assert

Multiple calls to CodeAccessPermission.Assert
(S)\Classes\SkipAOSValidationPermission\assert
(S)\Classes\BatchRun\runJob - line 166
(S)\Classes\BatchRun\do - line 54
(C)\Forms\BatchRun\Methods\doBatch - line 18

Sometimes I got this error while working with Change based alerts batch processing. After that the status of the related job in batch list changed to Executing, and the only way to get rid of it was deleting that job.


This issue arises in [Classes]BatchRun.runJob method because of absence of closing revertAssert() method in case of exceptions after calling runas() method.

So, my solution is to comment the existing call of revertAssert()...

if (batchClass.runsImpersonated())
        {
            // Ok to assert here because the user name comes from
            // the batch table
            runAsPermission = new RunAsPermission(batch.CreatedBy);
            runAsPermission.assert();
            // BP Deviation Documented
            runas(batch.CreatedBy,
                classnum(BatchRun),
                staticmethodstr(BatchRun, runJobStatic),
                [batchId]);

           // Alexey Voytsekhovskiy (SIS) (2010/02/08) (Demande #0074)
           // CodeAccessPermission::revertAssert();
        }
        else
        {
            BatchRun::runJobStatic([batchId]);
        }

and move it after catching all kind of exceptions:


catch (Exception::UpdateConflictNotRecovered)
    {
        isErrorCaught   = true;
        exception       = Exception::UpdateConflictNotRecovered;
    }

    // Alexey Voytsekhovskiy (SIS) (2010/02/08) (Demande #0074)
    // in case of exception Permssion should be revert anyway!!
    CodeAccessPermission::revertAssert();

It allows to avoid multiple calls to CodeAccessPermission.Assert (there is another call far in this method) and see the log of the job ended with an error.


By the way, here is a short and sweet trick with multiple calls if needed.

Monday, May 4, 2009

Developer for Microsoft Dynamics AX Certification Roadmap

Microsoft Certified Business Management Solutions Professional - Developer for Microsoft Dynamics AX

MB6-819 AX 2009 Development Introduction

MB6-821 AX 2009 MorphX Solution Development

Collection 80011AE: Development I in Microsoft Dynamics AX 2009 (4 Hours)

Development I – Architecture

Development I - Data Dictionary

Development I - User Interfaces

Development I - Report Adjustments


Collection 80012AE: Development II in Microsoft Dynamics AX 2009 (3 Hours)

Development II - X++ Overview

Development II - Classes and Objects

Development II - X++ Control Statements

Development II - X++ Control Statements

Development II - Accessing the Database

Development II - Exception Handling

Development II - Appendix


MB6-820 AX 2009 Installation & Configuration

80019AE: Installation and Configuration for Microsoft Dynamics AX 2009 (6 Hours)

Installation and Configuration - Overview

Installation and Configuration - Planning Microsoft Dynamics AX Install

Installation and Configuration - Installing and Deploying Enterprise Portal

Installation and Configuration - Installing AIF Web Services

Installation and Configuration - Initializing Microsoft Dynamics AX

Installation and Configuration - Installing the Base System

Installation and Configuration – Deploying

Installation and Configuration - Installing and Deploying Workflow

Installation and Configuration - Install Microsoft Dynamics AX Reporting

MB6-825 AX 2009 Enterprise Portal Development

(-)

MB6-817 AX 2009 Trade & Logistics

80024AE: Trade and Logistics I in Microsoft Dynamics AX 2009 (9 Hours)

Trade and Logistics I - Introduction

Trade and Logistics I - Inventory

Trade and Logistics I - Purchase Orders and Purchase Order Posting

Trade and Logistics I - Serial and Batch Numbers

Trade and Logistics I - Item Arrival and Registration

Trade and Logistics I - Quarantine Management

Trade and Logistics I - Vendor Returns

Trade and Logistics I - Sales Orders and Sales Order Posting

Trade and Logistics I - Sales Order Picking

Trade and Logistics I - Over/Under Delivery and Miscellaneous Charges

Trade and Logistics I - Customer Returns

80025AE: Trade and Logistics II in Microsoft Dynamics AX 2009 (8 Hours)

Trade and Logistics II - Customer and Vendor Trade Agreements

Trade and Logistics II - Inventory Reporting and Statistics

Trade and Logistics II - Purchase Requisitions

Trade and Logistics II - Request for Quote

Trade and Logistics II - Transfer Orders

Trade and Logistics II - Sales Quotations

Trade and Logistics II - Quality Management

Trade and Logistics II - Reservations

Trade and Logistics II - Commissions

Trade and Logistics II - Inventory Journals

80010AE: Bill of Material in Microsoft Dynamics AX 2009 (6 Hours)

Bill of Materials - BOM Overview

Bill of Materials - Create Simple BOMs

Bill of Materials - Reports and Other BOM Functionality

Bill of Materials - Report a BOM as Finished

Bill of Materials - Scrap and Measurement

Bill of Materials - BOM Calculations

Bill of Materials - Creating BOMs with Versions

Bill of Materials - Sales Orders and BOMs

Bill of Materials - Working with BOM and Item Configurations

Full list of AX2009 exams

Friday, December 19, 2008

Synchronisation Error: Cannot execute a data definition language command on ().

It is really useful job to cure this senseless error. Taken from russian Axapta forum.