Archive

Posts Tagged ‘Dynamics Ax’

Error: SSRS/EP error when the return type in display method is incorrect – Dynamics AX 2012

October 11, 2013 1 comment

When you work with data sources through a query in EP/SSRS you might land up in this error “Data or calculated fields with type “Record” are not supported”.

Record_type_error (2)

How do i resolve ?

One of the tables that is being used in the data source has a display method with a return type as “record”. ¬†Scan through all the display methods and find the one that has the display keyword but still returns a type record in the signature. In our case we had a method similar to this

    Public display inventTable getInventTable()
    {
         return InventTable::find(this.itemid);
    }

Why does this happen ?

It is illegal to use a display keyword for a method that returns any complex object like “Container”, “Record”, “Class”. The reason we don’t find it inside AX is because compiler doesn’t validate it and it can be deducted only at run time. So say you have you a display method as in the example above but you never use it then AX never complains about it.

When these tables are accessed through Query in SSRS, SSRS tries to run through the list of display methods to show up in the field selection. Since SSRS cannot comprehend the return type it throws this error.

For more tips and learning about SSRS – AX 2012 order the book Dynamics AX 2012 Reporting Cookbook authored by me.

7720EN_MockupCover_Cookbook

Productivity tip: Do you need the under score when naming – Dynamics Ax

October 4, 2013 Leave a comment

Well When we sat through the product review there was one simple point that caught our attention, surprisingly it helped us improve our productivity. This post is to share on what we learnt.

Typically i have seen several implementation and product development teams adopting the ‘_'(underscore) naming convention. In fact we followed it through out Dynamics AX 2009. Though at the very first look it appears helpful in hindsight it deters productivity.

How ?

1. While you type holding a shift key is not making typing faster.

2. Every time you declare a variable you are again held up with underscores

3. On the AOT node navigating is definitely not easier.

If you look all these points at a component level it can be ignored but when you do it over and over it adds up to a significant time.

Next time you start a new project or product consider if you need to use the underscore ‘_’ again.

Dynamics Ax 2012 Reporting cookbook published & 5 reasons why you should go for it

September 30, 2013 Leave a comment

Hello everyone,

I’m very happy to inform you that the Dynamics AX reporting cookbook I authored is now published and available through major retailers online.

amazon-com amazon-co-uk barnes-nobleimages

If you had pre-ordered it through packt then you should already have it in your hand. If not and you are still thinking if this book is for you, here are 5 reasons that tells you how buying this book is a good choice.

7720EN_MockupCover_Cookbook

  1. Understand the inners of reporting Framework: This book helps you understand the framework portions like the controller, preprocessing, temptable marshaller to the depth with the help of flowcharts and diagrams. Just because you do it better when you know it better.
  2. Better choice of controllers and data source: The book has one or more examples for all the possible controls including the ones that are not found in the out of the box reports and discusses every possible data source available for the reports with examples. Just because you make a better choice when you know the options better.
  3. Speed up development and testing: Inside the book there are unique techniques that can help you speed up development as well gain time by quick tricks to fasten testing. Just because you get time to be creative when you make your routines easier.
  4. Implementation pattern reference: There are recipes in this book for typical development patterns like validations, defaulting values, building lookups, multi value lookups, inventory & financial dimensions and much more. Just because Google is not your only friend we are here too ūüôā
  5. Analyze and Handle issues faster: The book has step by step in detail guidance to approach development issues, upgrades and design. It speaks about additional tools that can help you understand report performance and usage. Just because your mysterious must not remain unresolved.

curious and want to know more before buying ??

Look at the table of contents here  or Download the sample chapter from here

Interested in reviewing this book in  your blog ? Please contact me @casperkamal[at]gmail[dot]com

Interested in learning SSRS – Attend my SSRS session at AXUG see more details here

This blog has more SSRS tips revealed from the book read them here

Producvity tip: Don’t scroll use Ctrl + G in your Editor – Dynamics Ax

September 27, 2013 Leave a comment

The other day as i was reviewing a code modification to a long method from my team mate he had to walk me up and down through the code scrolling.

Just then the Ctrl + G flashed in me. Yes It takes a lot less effort to type in the line number then scrolling up and down. Even if you are not sure of the line number make it a guess then it is always a few lines up or down.

Go_to_line

If you are newbie here is how you can find the line number

On AX 2009 

You can identify the line number in the status bar.

2009_LineNum

On AX 2012

Activate the toggle line number in the tool bar or identify the line number from the status bar

Ax2012_LineNum_001

Best practice

Ideally keeping best practices in mind you must right methods that have limited number of lines and break them and keep it modular.

SSRS Tip: Prevent report execution through controller – Dynamics Ax 2012

September 25, 2013 Leave a comment

What a user might hate to see is a blank report. No matter where the mistake lies the earlier we react the happier the user is. Here today i’m sharing a tip on how you could stop/warn/show a info after the report execution is initiated ¬†after the user clicks the “Ok” button in the dialog.

In the example discussed here, the idea is to check preemptively if a query will return a record or not. If no then the report aborts execution.

To implement this, open the controller of your report or create one.

On the controller class, override the method “preRunValidate”

Place the code as shown here. This method is invoked after the user clicks the “Ok” button and before the report is executed. Do not block the super call in this method as it does few other important validations. This method can return an error/warning/info. If it is a warning or error the report aborts further execution.

protected container preRunValidate()
{
    container   validateResult = super();
    Query       firstQuery;
    int         recordcount;

    firstQuery          = this.getFirstQuery();
    custStatementCount  = QueryRun::getQueryRowCount(firstQuery, 6);
    if (custStatementCount > 5)
    {
        validateResult = [SrsReportPreRunState::Error, "No valid records found for the specified range"];
    }

    return validateResult;
}

Standard recommends the method to be used for validating if the report returns a large amount of data.For reference see \Classes\CustAgingReportController\preRunValidate\
For more tips and learning about SSRS – AX 2012 order the book Dynamics AX 2012 Reporting Cookbook authored by me.

7720EN_MockupCover_Cookbook

SSRS Tip: Printing Row headers in every page – Dynamics Ax 2012

September 23, 2013 2 comments

This post today will discuss how to print row headers in every page for tablix.

When your table has a header

When using table type tablix with headers as seen in the below image, right click on the Tablix properties and select “Repeat header rows on each page” (If you use a matrix control please check the same for “Repeat header columns on each page”)

RepeatHeader

When you use a static tablix member in Row or Column.

If you don’t realize what a static tablix member, select a table and insert a row using the option “Outside Group – Above” or simply Insert Row -> Above if you don’t have any groupings. Now open the Group mode window (if not open, click the grouping icon from your report tool bar grouping_windo) and then click Advanced mode. The system will show up static members in a table. These are members that are calculated once and are rendered in one or multiple pages. These controls can also be used like headers.

Coming back, Once you have identified the static tablix member you want to repeat, On the property of the tablix member set “RepeatOnNewPage” to True. (If this doesn’t work outright, try setting the property “KeepWithGroup” ¬†to “After”)

2013-09-20_1954

For more tips and learning about SSRS РAX 2012 order the book Dynamics AX 2012 Reporting Cookbook authored by me.

7720EN_MockupCover_Cookbook

Dev Tip: Activating document handling for inquiry(read only) forms – Dynamics Ax 2012

September 20, 2013 Leave a comment

This post will explain how document handling can be activated only for specific tables or for all tables.

Activate document handling for selective tables.

To activate document handling for selective tables.

Go to Organization administration -> Setup -> Document management -> Document management parameters

Check the flag “Use active document tables

selective_active_document

Once specified here then document handling is active only for selective list of tables. To specify the active list of tables  go to Organization administration -> Setup -> Document management -> Active document tables. Document handling is now only enabled for the selected tables in a controlled mode.

active_doc_table

Activate document handling for all tables.

Simply unchecking the¬†¬†“Use active document tables” in Document management parameters makes it activate for all tables. There is a limitation here, in the case where document handling is enabled for all tables the system verifies if the table has edit/delete permission. Only if it is the case document handling is activated otherwise it is disabled. E.g This means tables like Salestable/Salesline will have permission to add/edit documents while forms that uses tables like custInvoiceJour, vendinvoice jour will have document handling disabled.

User’s may ask for document handling to be activated on these read only ¬†forms. In these case there is a way out.

Go to¬†Organization administration -> Setup -> Document management -> Active document tables and enter the table name, say “VendInvoiceJour” also make sure to check the “Always enabled” flag. This is very important since this means the document handling is enabled irrespective of the table permission. So this way you can activate document handling for read only tables

alwayenabled

\Forms\DocuView\Methods\doReSearch – Go to this method

on line Number: 130 – add the following line,

allowEditBasedOnActualForm = true

codeimage

Setting this will enable you to use the full document handling feature even for read only forms.

SSRS tip: No row message in Dynamics Ax SSRS 2012

September 9, 2013 13 comments

Some sections in your report may not have data but the header sections ¬†might print. In these cases to make it informative for the user a “No data available” message might be helpful since the user is then assured that there is no data for that particular data section. This tip will guide you on how to setup “No data available”.

Select the Tablix/List/Matrix control where you want the message to be available and open the properties window, Find the property “NoRowsMessage”. This property can be filled in with text or for dynamic text using expressions. Type in something like “No data available”

2013-08-30_1553

When there is no data for that particular section SSRS automatically prints the text under “NoRowsMessage”

2013-08-30_1550
For more tips and learning about SSRS РAX 2012 order the book Dynamics AX 2012 Reporting Cookbook authored by me.

7720EN_MockupCover_Cookbook

SSRS tip: Take care that VS and AX client are in the same layer for SSRS – Dynamics AX 2012

September 5, 2013 14 comments

Some times when you use configuration files to start your AX client like this in the image and also work on visual studio, make sure your default client configuration is pointing to the same layer as in the configuration file.

2013-08-30_1528

This is because the Visual studio opens in the layer that is specified in the default settings in AX Client Configuration window. Though your AX client is on VAR layer if your default client configuration setting is pointing to the USR layer then the visual studio reporting project gets saved to the USR layer. You end up in deleting and reimporting the entire project. So make sure to verify the layer setup before you start working on reporting projects.

To setup the default layer configuration, 

Open the run window and type axclicfg

In the window that opens create a new configuration or on the existing configuration go to the Developer tab and verify the layer information including the license

2013-08-30_1535

For more tips and learning about SSRS РAX 2012 order the book Dynamics AX 2012 Reporting Cookbook authored by me.

7720EN_MockupCover_Cookbook

Interview: Murray Fife – Author Extending Dynamics Ax 2012 Cookbook

September 3, 2013 1 comment

In this short interview with Murray on his release of book Extending Dynamics Ax 2012 learn more about his experience of writing his book, how this book can benefit users, his future plans and get to know the software tools that makes Murray a productive man in the AX world. I would like to Thanks Murray for offering his time towards this interview.

How is the experience of authoring a book, this being your first book in spite of many publications on the web so far?

Murray Fife ImageWriting the book was thoroughly enjoyable, and was not as hard as I thought it was going to be.  This was partly because I had already compiled all of the content through my past blog posts, and also because I had got into the habit of writing because of the blogging.  One added benefit, I think that writing the book improved by blog posts as well, because I now structure them in a way that I can easily convert them over to more of a chapter format if I need too.

One aspect that was a new experience though while writing the book was the editing and critique.  For the first chapter, I was caught off guard, but after sucking back my pride, and taking an objective look at what the editors and reviewers were suggesting, I soon realized that critique is great, and incorporating their suggestions only made the book better.

 How will readers benefit from this book?

This book is all about doing more with what you already have.  Dynamics AX is a great application, but there are other tools that you probably have laying about within your organization that you can use in8331EN_cover conjunction with Dynamics AX to make it even better.  I tried to make the examples in the book useful enough to be used at least as a starting point for solving common problems that everyone is having.  Once you have mastered a chapter, you may find that you are able to extend out even further than the book does.

Also, there is probably about 20 lines of code in the whole book, and even those examples are simple enough that a non-developer would be able to add them to Dynamics AX.  I did this on purpose, because a lot of the examples are configurable, not developed.  I wanted the power users to take control of Dynamics AX and do more with it.

What tools or software’s that you use to make yourself productive and would recommend other Dynamics Ax community?

Apart from the tools that everyone is probably familiar with like PowerPoint (which is my storyboarding tool), SkyDrive (which allows me to access all of my files from any of my computers), Word (for collaboration and review), and PaintShopPro (for image cropping), I need to highlight one of the most useful tools in my utility belt, which is DuckLink Screen Capture (http://www.ducklink.com/p/free-screen-capture-tool/).  This is free, and is the Swiss Army knife of screen capture.  I don’t know where the name came from, but I don’t care, because I could not live without it.

 What topics are you currently working with respect to Dynamics Ax?

I am continuing to learn the other areas of Dynamics AX ‚Äď there is so much functionality in the system, and so many gems hidden away that I doubt that I will stop.

 I already have enough content for a second Extensions Cookbook and have submitted it to PACKT for approval.  This one will be a little more functional, and show how you can configure the secondary features that people want to use, but are maybe a little too intimidated to try tackling.  Including Lean Manufacturing, Retail, Costing, Development of new Workflows, and Service Management.  I think that illustrating these examples will show people that they are really not that hard to configure, but still very useful and something to take advantage of.

 A follow on project that I have just started planning out is a guide for configuring Dynamics AX from a blank system.  It may seem daunting to configure a completely new system, but it’s not that hard.  Getting the base data in to a point where you can start running common business transactions is not hard if you don’t over-complicate it.  I am sure that companies just starting to implement Dynamics AX will like the content.

Read the review of the book here