Friday, September 14, 2007

Compare Tool

Do you know that you can compare an AOT object with the object in:

- Standard layer version types
- Old laye version types
- Version Control revisions
- Best Practices washed version
- Export / Import file
- Upgraded version


U can find a very helpful article at following address:
http://insidedynamicsax.blogspot.com/2007/09/compare-tool.html

Friday, September 7, 2007

BaseEnum Field Mandatory

If you set mandatory to a BaseEnum field in a table then the Element having Value = 0 of this BaseEnum would not be accessible.

This is because generally Zeroth Index is basically used for 'None' in AX. Now to make sure that user does not select 'None' as an option in the field, this is the default behavior of AX.

So the suggestion is that you should not use Zeroth index for any Element of a BaseEnum except 'None'. If you don't have any 'None' element in your BaseEnum then start the elements from 1, otherwise, if you would set it mandatory then user may not set it.

Muhammad Shujaat Siddiqi

Cloning Table Buffers in Dynamics AX

I was wondering how would i clone a table method in my code as there is no clone method on Table buffer. There is also no property on a table which set it CLONEABLE.

There I find another way of doing this. i.e. I can copy all the contents of one Table buffer to other using data method of Table buffers.

This is like:

Table1 table11;
Table1 table22;

table11.data(table22.data());

This would copy all the conents of table22 to table11. Otherwise setting it like this:
table11 = table22;
would set both the reference to same object which may not be required.

Shujaat.

Thursday, September 6, 2007

Configuration Key checking through code

Sometimes there is a requirement to check the availibility of configuration key in code to make some functionality available to user.

AX provides this facility in code in Global. The method is isConfigurationKeyEnabled(). This method takes ConfigId as argument and returns boolean.

isConfigurationkeyEnabled(configurationKeyNum(AIF))

Enjoy this...........

Muhammad Shujaat Siddiqi

Unit Testing Table methods in AX

There are few additional requirements to unit test table methods.

Override following methods:

1- testElementName
public identifiername testsElementName()
{
identifiername ret;
ret = super();
return "Table1";
}

2- testElementType()
public UtilElementType testsElementType()
{
return UtilElementType::Table;
}

If you don't override these methods then there would be ZERO code coverage of your methods.

Don't forget to inherit your Unit Test class from SysTestCase.
Also take care of the naming requirement of your Unit Test Class.
The name of method must also be in accordance with the naming requirement of methods.

Thanks.

Shujaat.

Wednesday, August 22, 2007

Sorting and Filtering on Display method based grid columns

Hello friendz,

It is interesting to know that AX does not allow sorting and filtering on any column of the grid which is based on the display method. Someone has told me that research is on the way to incorporate the sorting and filtering on display method based grid columns.

Til then we wait........... :)

Shujaat.

Sunday, August 12, 2007

Alternate of Formula Fields of Crystal reports in Dynamics AX Reports

Hello guyz,
I am writing frequently nowadays. It means that i am doing lots of work. I was to prepare some report for some of my client. Generally back in the days of .net and crystal report, the functionality which was required to be implemented could easily be fulfilled by Formula Fields. But to my astonishment, there are no formula fields in Dynamics AX reports.

There is an alternative to it. AX allows you to have programmable sections in the report. In these programmable section, you can insert different control. So i inserted on control having String Type Data.

Set the AutoDeclaration property of this control to TRUE. In this way you can programmably access this control.
Now override executeSection() method of this programmable section and write your programmable logic in this method.

You are done!!!!!!!!

Wednesday, August 8, 2007

View does not support display methods and field groups

I completed my design today assuming that there is support of display methods and fieldgroup support in Views in Dynamics AX. But to my surprise a view does not support any of them. i.e. I can not add display methods or fieldgroups defined on table as fields in a view. :(

So guyz!!!!!!!!!!

update ur knowledge with this feature of Views :)

Shujaat

Tuesday, August 7, 2007

Why Asset Status on Value Model and Depreciation Book

There is no field related to status of Asset in Fixed Asset form / table (AssetTabler) of Dynamics AX. People think that they should use AssetStatus field in this regard.

I was just wondering why this AssetStatus field is with ValueModel or Depreciation book associated with stated Fixed Asset. But as soon as u see the Help text associated with this Status field u understand that this is about depreciation of fixed asset and not the fixed asset itself.

The help text says, "How to depreciate? Open = automatically, Suspended = no depreciation".
It still does not explain what other values of this BaseEnum mean.

So this status is about depreciation and not about Fixed Asset itself.

Got it!!!!!!!!!!!!!

Order by clause before Where Clause (Dynamics AX Select)

People who are aware of SQL must know that Order by clause is always written after where clause in SQL Selects.

In X++ this is different. Order by is always written before where clause.

The example code is as below.

select firstonly BookId from assetBook order by BookId desc where assetBook.AssetId == this.AssetId

Cheers.
Shujaat.

Saturday, August 4, 2007

CASE / DECODE in Dynamic AX Queries / Select

For those of you who are used to using CASE / DECODE in SQL i have some information.

They are not supported in Dynamics AX. Now what to do to get the work done for which these constructs are used in SQL.

To go for the work around, first we should understand what they are used for in SQL queries. They are used for making decision about which information to display based on other columns information in data got as a result of querying the database.

The same work can be done if we used DISPLAY function in X++. They will definitely not be used in Select / Query directly but in the form, report etc that the result of query is used in. For the information about display function, you can read Inside Dynamics AX.

Cheers......................

Thursday, August 2, 2007

Union in Axapta Queries (Dynamics AX)

I am used to using the UNION in SQL Queries but I could not find this feature in Axapta Select or Queries.

Then i came to know that UNION and CASE is not supported by AX selects or queries:

For Union a workaround is the loop all records and insert them into a temporary table or a RecordSortedList.

You might have to use the WHERE clause instead

Wait for these features to be incorporated in AX queries or Selects.

:)

Saturday, July 21, 2007

Debugging in Dynamics AX with Business Connector (Enterprise Portal)

I have gone through hell when i tried to debug some of my code in Enterprise Portal Dynamics Axapta. As a matter of fact, it didn't work.
I thought there is some problem with my AOS server debugging settings in AX. After setting the same the problem remained the same.
By mistake i remained my Debugger opened and the break point was hit. So i got to the conclusion that to debug X++ code in AX, when Business Connector is used, it is necessary to open the debugger in advance and it does not open on itself.
If anyone has any different opinion just tell me.

Thanks buddy........

Thursday, July 19, 2007

Installing Enterprise Portal Dynamics

The Microsoft official guide for Enterprise portal installation didn't work for me.
I used the following steps for installation which i found on some blog. For your info:

Task Steps

Task 1:
Create a Web form.
1. Start the Dynamics AX client.
2. Press CTRL+D to open the AOT, or click the AOT button on the toolbar. Open a second instance of the AOT and position it next to the first.
3. In the left AOT window, expand the Data Dictionary node.
4. Expand the Tables node.
5. Locate the CustTable table. This is the main table that stores customer master file information.
6. In the right AOT,expand the Web node.
7. Right-click the Web Forms node, and then click New Web Form.
8. Expand the new Web form. Then drag the CustTable table identified in Step 5 from the left AOT onto the data sourcesof the new Web form in the right AOT.
9. Expand the Designs node of the new Web form.
10. Right-click Design, point to New Control, and then click WebGrid.
11. Right-click the new WebGrid control, and then click Properties.
12. Set the DataSource to CustTable.
13. Right-click WebGrid, point to Add New Control, and then click WebEdit.
14. Right-click the new WebEdit control, and then click Properties.
15. Set the DataSource to CustTable and the DataField to Name.
16. Click Save All on the AOT toolbar of the right AOT.

Task 2: Create Web content.
1. In the left AOT, expand Web, expand Web Content, and locate Display.
2. In the right AOT, expand Web, expand Web Forms, and locate the new Web form created in Task 1.
3. Drag the Web form from the right AOT to the Web Content\Display node on the left AOT
4. Click Save All on the AOT toolbar of the left AOT window.

Task 3: Create a Web page.
1. In Internet Explorer, navigate to the home page of the EP by entering the URL.
2. Click Site Actions/ Create on the global menu (top horizontal menu).
3. Click Web Part Page.
4. Type a name for the page, select the Header, Left Column, and Body layout templates, and then select the Document Library as the Enterprise Portal.
5. Click Create.
6. Drag WebFormWebPart from Web Part List on the right side to the Body section.
7. Click the down arrow on the WebFormWebPart, and then click Modify Shared Web Part.
8. For WebDisplayContentItemName, select the Web content created in Task 2.
9. Click OK.

Friday, July 6, 2007

Code Complexity Analysis X++ presentation ppt

Yesterday i have given a very good presentation regarding Code Complexity Analysis. You can just download the presentation.



The presentation also has some dialogue between a QA and Software Developer. In that dialogue i have tried to understand which metrics are present for analysis.



Again this was all about using the Andress XPO.



You can have great knowledge by just viewing the presentation and Dialogue document. I will upload the presentation as soon as possible.



Muhammad Shujaat Siddiqi

Tuesday, June 26, 2007

Axapta X++ Code complexity

Today i have studied a very unique feature of axapta which is code complexity. it is implemented by some graduate student from Denmark Technical University. By using this feature, we can easily determine the complexity of our code.

This feature can certainly help us in limiting the complexity of the code. This can also make the code easy to test. The test coverage is definitely increased because the test is covering more code.

The code would be more maintainable. Bugs are easy to fix. It is also easier to add new functionality.

U can find further on this on the link below:

http://www.axaptapedia.com/Complexity_analysis_in_best_practice_checks

Saturday, March 31, 2007

Never use Long datatype in Oracle

I had a problem...............
I was using Varchar2 for a column.....
The datasize for that column increased.................
I searched which datatype to choose from which could hold alphanumerics and also larger in size than varchar2.....
I found and used Long................

Now at some other time i had to enable auditing on this table through DML trigger.....
It was not allowing to compile it correctly.

I came to know many shortcomings of Long.

"Long columns can not be accesses using :new or :old"

I cursed the day i used this datatype rather than LOBs.

There is only one way that you can use as a work around.

Dont use long attribute of a tuple using :new or :old but through primary key get the value of Long column for this particular tuple (using Select Into)
Now you can use this value for auditing.
There are mutating table problems still..........which you can handle.