Archive

Archive for the ‘Ax Technical’ Category

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.

Advertisements

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: 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: Using invisible parameters in contracts – Dynamics AX 2012

September 18, 2013 3 comments

There can be cases where you wanted a contract in the attribute but do not want the UI builder to expose it to the user. The reporting framework in AX provides a very easy way to incorporate this.

Open the parm method in the contract that you don’t want to expose. Add the attribute shown here along with other attributes. This attribute when found in the parm method will automatically prevent the UI builder from adding this to the dialog.

[DataMemberAttribute, SysOperationControlVisibilityAttribute(false)]
public LogisticsAddressing parmAddress(LogisticsAddressing _address = companyAddress)
{
companyAddress = _address;
return companyAddress;
}

This feature comes as a part of the BOF, see here http://j.mp/185ufd2

Update: Apologize for the wrong statement here. The only way to make a parameter visible when using the contract with reporting framework is to specify it in the design. This is because the contract class \Classes\SrsReportRdpDataContractInfo\buildMemberAndNestedObjectMap – 29 ignores this attribute and reads the design RDL (created using your VS) to decide if a parameter must be visible in the contract. So to hide your parameter open the parameters node in Visual studio and then set the visibility property to hidden.Also a point to understand is that the VS design overrides any specifications at the contract level for properties like  LableHelp, Visibility, grouping, HelpText, value type (multivalue) etc. (Ref: \Classes\SrsReportRdpDataContractInfo\fillReportDesignProperties). Thanks to a AXForum member who pointed this out.

2013-09-30_1910

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: Finding if a range is specified in a query – Dynamics Ax

August 26, 2013 2 comments

Here is a simple tip.

Recently i had a requirement which wanted to validate if a range has been entered in a query. The obvious approach would be running through the ranges in the query data sources and verify if each of them has a range. When you have multiple data source this is obviously not an interesting way to solve it and can be fooled around by just entering a value like ‘*’. So i was thinking out on a better approach and luckily i seemed to find it. Here it goes, the idea is to get the count of the records through the Query and get the count of the records directly through a DML, when compared if they are equal then there is no range entered.


InventTable inventTable;
int cntTotal;
;

cntTotal = SysQuery::countTotal(gQueryRun);

select count(recid) from inventTable;

if (inventTable.RecId == cntTotal)
{
throw error('Atleast one range must be specified for the item selection.');
}

Where can this be used ?

You can put it to use to prevent long running reports http://bit.ly/1bzGHVE to ensure that there are proper ranges.

Related articles

Dev Tip: Finding test data across companies – Dynamics Ax

August 14, 2013 4 comments

This is going to be an obvious tip but the application is really very useful..

Most of the time as developers we get in to the daunting task of preparing test data to validate our changes. As developers we might either find it a mammoth task to fill all the data and do a test. The easiest shortcut we would look for is finding an existing data. The challenge we get in to often is a strange table which we don’t know how it gets filled even and we need to find if there is a data in any company. Searching the data comes with the difficulty to switch across 10 companies, opening the table browser and look for data. Here is a quick way to cut down your efforts.

Idea 1: Go to the SQL server management studio and right a simple group by statement.

Draw back: As a developer not all times i have the comfort of access to the SQL server

Idea 2: No issues. we have the power 🙂 Use the cross company feature :)…

In the example shown here we are searching for the list of companies that have record for tax trans.

    TaxTrans taxTrans;

    while select crosscompany  *  from taxtrans
    group by dataareaid
    {
         info(taxTrans.dataAreaId);
    }

you can apply this query with more conditions and joins to narrow down your search.

Read here more on cross company query  http://j.mp/13ejLbX

Happy finding !!!