Friday, October 5, 2007

using brackets in macro

Question: I am getting a syntax error in macro
#define.ActiveDateCriteria("(%1 == %2)")
can't i use brackets in macros

Answer: Try using escape sequences

#define.ActiveDateCriteria("(\%1 == \%2)")

Monday, September 10, 2007

Microsoft Dynamics AX Msc Application Development and MBA Information System

University of Sheffield Hallam along with microsoft and interquad are offering a unique course in Microsoft Dynamics AX.

these degree awards are an excellent way of jumping in the world of ERP.
vist their home page : www.shu.ac.uk

programmer personality type

Today i found that my personality type is
PHSB

You're a Planner.
You may be slow, but you'll usually find the best solution. If something's worth doing, it's worth doing right.


You like coding at a High level.
The world is made up of objects and components, you should create your programs in the same way.


You work best in a Solo situation.
The best way to program is by yourself. There's no communication problems, you know every part of the code allowing you to write the best programs possible.


You are a liBeral programmer.
Programming is a complex task and you should use white space and comments as freely as possible to help simplify the task. We're not writing on paper anymore so we can take up as much room as we need.

Check out your personality type at www.doolwind.com

Thursday, September 6, 2007

Dynamics Live Community

Today I just ran by an excellent site featuring dynamics ax. Microsoft Dynamics Live Community
contains information related to finance. You can collaborate with people running dynamics ax in there financial sector. There are lots of blogs from microsoft executives. Other tools related to dynamics ax are also present. Must have a look.

Friday, August 31, 2007

Overriding method for a control in dialog (RunBase framework)

Scenario:
Can we have an overridden method in a dialog class. I can not use form as a dialog. I have to add a method in the dialog class. Like modified method of an EDT.

Answer:
Well it can be done. First you have to add a method dialogPostRun

public void dialogPostRun(DialogRunbase dialog)
{
;
dialog.dialogForm().formRun().controlMethodOverload(true);
dialog.dialogForm().formRun().controlMethodOverloadObject(this);
dialog.formRun().controlMethodOverload(true);
dialog.formRun().controlMethodOverloadObject(this);
super(dialog);
}

This method actually allows the dialog form to override control method at runtime. Now we need the name of the control at runtine that needs the overriden method. You can get that using

print dialogCustId.name();
pause;

where dialogCustId is the EDT. let say the name returned at runtime is Fld3_1.


Now if you have to override lookup method of the EDT you can write the method like this

void Fld3_1_lookup()
{
//override lookup method here
}

If you need to override modified method

boolean Fld3_1_modified()
{
}

.
The modified method can also be accessed by overriding

public void dialogSelectCtrl()
{
}

in the runbase class. Just call

dialog.allowUpdateOnSelectCtrl(true);

in the dialog method.

You can also create a dialog form and pass it as the parameter in the dialog method of runbase class. you can find an example in tutorial_runbase class and form.

Tuesday, August 28, 2007

Get field label in X++

Scenario: I want to use the label of a field in code.

Answer: Use SysDictField class

SysDictField dict = new SysDictField(tableId, fieldId);
str label = dict.label();

Query on table

Scenario:Can I use query on table; give some examples on exisitng tables;

Answer: Yes you can use queries on axapta tables like any other code. You can have a look at the InventSum table newQuery() method.

Saturday, August 25, 2007

Dynamics AX Certification

Microsoft Dynamics AX 4.0 Development
Introduction Certification Exam (VUE Exam # AX 40-508,
Prometric Exam # MB6-508) Preparation Guide


Target Audience
Individuals wishing to obtain a certification on Microsoft Dynamics AX 4.0 Development Introduction should take this exam.

Exam Specifics Skills Being Measured:
This certification exam measures your ability to understand and use the integrated development environment of Microsoft Dynamics AX, MorphX Development Suite. You will be tested in the AX Architecture, Data Dictionary, user interfaces and Report adjustments. You will also be measured in how to use X++, Classes, Control statements, Data Base access and Exception Handling.

Time Requirements and Questions:
90 minutes to complete the exam
75 questions with a passing rate of 70%
Multiple Choice and Multiple Answer questions

Registration:
Register for VUE Exam# AX 40-508 AX 4.0 Development Introduction Certification Exam at
Pearson VUE
Register for Prometric Exam# MB6-508 AX 4.0 Development Introduction Certification Exam
at Thompson Prometric

Exam Preparation Tools
In addition to your hands-on experience working with the product, we highly recommend using the
following tools and training to help you prepare for this exam:
Training Materials:
8623: Development I in Microsoft Dynamics AX 4.0
8633: Development II in Microsoft Dynamics AX 4.0
Instructor-Led Training (Please check with your region to verify instructor-led training
availability):
8623: Development I in Microsoft Dynamics AX 4.0
8633: Development II in Microsoft Dynamics AX 4.0
For training materials in additional languages visit Training Materials and search for additional languages.
For instructor-led training in additional languages please visit Find Training and search for courses in
additional languages.

Additional Skills Recommended:
Experience in object oriented programming

Exam Topics
General Microsoft AX Architecture – 18%
Understanding of 3-tier Architecture
Understanding of AOS
Knowledge of Layer Technology and how to Work with Them
Understanding of Label System and Creating Label Files
Development Tools - 18%
General Knowledge of AOT
How to use Intellimorph
How to Import/Export Objects
Debugging Techniquest
Visio
Application Objects– 21%
Creating Data Dictionary Objects
Creating and Working with Forms
Setting Up Projects
Creating and Working with Reports
Creating and Working with Queries
Creating and Working with Menus and Menu Items
Utilizing the Security Structure
Utilizing the Configuration Structure
Table Collections and Virtual Companies
X++ Development – 27%
Data Manipulation/Accessing the Database
Working with Maps
Interacting with the User
Working with Data Models
Working with Class Models
AX-specific Select Techniquest
Best Practices – 16%
Using Naming Conventions
General X++ Coding Standards
Using Validation Techniques

Display method in code

Scenario: Can i use display methods in X++ code. I mean if i have a display method getStatus() on table Vend. I can use it like vend.getStatus(). Is it a violation of best practice what are the pros and cons.

Answer: No, there is no performance penalty and no best practice warning is issued.
So you can go ahead and use the display methods in code.
The only difference from a non-display method is that you can actually use them in forms and reports.

Snippet:
Add as display method getStatus() in the CustTabl method list.

public display boolean getStatus()
{
return true;
}

Use this method in the field group and in the code simultaneously.

public void processCustomerStatus()
{
if (this.getStatus())
{
this.write();
}
else
{
info("Consider status");
}
}

Friday, August 24, 2007

Getting number of recrods present in a query run

Scenario: I want to get the total number of records from a query run object. I will use them to generate a progress bar (progress indication framework).

Answer: Use SysQuery::countloop(qr). this will return the total number of records in a query object.

Thursday, August 23, 2007

Customized Form as Dialog Box

Scenario: I need to create a runbase dialog with saving options. I need to have a runbase calling a form present in AOT.

Answer:
Override dialog method of runbase
public Object dialog()
{
FormRun dialogForm;
Args args = new Args(formstr(CustVendPaymProposalModPaymAttribDialog));
;
args.caller(this);

dialogForm = classfactory.formRunClass(args);
dialogForm.init();

return dialogForm;
}

CustVendPaymProposalModPaymAttribDialog is the dialog form which was created in order to
facilitate the design.

Customized auto report dynamics ax

Scenario: Can we have auto reports in dynamics ax.

Answer: You can not have customized auto reports in dynamics ax.

Filtering and Sorting in display methods

Scenario: Can we have sorting and filtering in display methods?

Answer: You can not have sorting or filtering in display methods.

Wednesday, August 22, 2007

Calling validate write of other tables in for datasource

Scenario:

I am stuck in an issue. I did some changes on CustTable form. CustTable form is dependent on four datasources. I did some validation on CustTable Table and OrganizationDetail Table. Now the issue is when the form is saved the validateWrite() on only the focused datasource is called. Is it possible that the validateWrite() of the whole form is called. I mean of all the datasources associated with the form.

Answer:

AFAIR, the system calls validateWrite only on the active datasource and on datasources that are joined with the active one.

So if your link type is active or delayed (not inner join, for example), then the validateWrite on such datasource won't get called. (it is a different query, after all).

well, you see. This is an impossible situation.


if your datasource is inner joined with CustTable, the validateWrite on this datasource would be called automatically.

So I gather that it is not inner joined. Which means that it's an active join (probably you have a separate grid or something showing data from this table).

And when you press Ctrl+S on the form, the validateWrite is called only on the active datasource.


so you have to write code on both validateMethods, making sure that the interconnected fields don't get wrong input. BUT you validate only data from the active dataSource.


So, if you save CustTable record, the custTable field is validated, and if it is a restricted combination, you say that this is the wrong value in CustTable, not in the related table.

And if you save the record in the related table, you validated only data on this table.


hope this makes sense to you

Accessing Parent Datasource

If you need access to the datasource() of the parent form. Parent form and child form being attached with dyna links you can use the following code snippet

element.args().record() to get the Datasource selected on the parent form.

For e.g. If you create a form named CustAdditions which is a child form to CustTable, and these two datasources are attached using dyna links and you want the selected CustTable record on child form you can write in the init method of CustAdditions

Code Snippet:
public void init()
{
CustTable custTable = element.args().record();
}

Tuesday, July 31, 2007

Dynamics AX Programming of Basic Methods of Tables

Definition and modification of methods in tables

When a new table in the Tree of Objects of the Application is created, MorphX automatically creates a series of methods for her. Adding X++ code to these methods we can modify the predetermined behavior of the system.
In addition, we can define our own methods. The methods of system and the user defined ones share he himself scope, therefore it is possible to add new methods that can be used from the methods defined by the system. As well as to accede to the system methods from any new method.
It is important to indicate that we cannot modify the type of return, the list of parameters or the type of these parameters in the methods defined by the system, although we can add additional parameters whenever we declare a value predetermined for them.

Methods of system

The system methods are executed when the table is used, for example, when we introduce, updated or erased data.
The body of these methods initially contains a call to the super method solely (). In later chapters method will be described with more east detail. To at the moment it is enough us with knowledge that corresponds to the predetermined behavior of the system. When X++ code is added to the methods defined by the system, east behavior is overloaded.
Next they appear the list of methods of system of a table. In later sections they will be described with more detail most important.

Method

It is executed when…

Caption

is the head of a form. The text is generated from the properties of the table.

Clear

the fields of the present registry erase (they have values NULL).

Delete

a registry is eliminated.

HelpField

the text of aid of a field is in the state bar, for example when we happened to the following field in a form.

InitValue

It initializes the fields of a registry just created.

Insert

a new registry in the table is introduced.

Merge

two registries are united or combined.

PostLoad

a registry is loaded.

RenamePrimaryKey

renombra the primary key of the table.

ReRead

a registry is reread.

ToolTipField

the leader of the mouse is located in a field of a form.

ToolTipRecord

one is going away to show an advice for the present field. The super method () makes a call to Caption.

Update

before modifying an existing registry.

ValidateDelete

one is going away to erase a registry.

ValidateField

a field give ins, for example when we jumped to the following field of a registry.

ValidateWrite

before writing a registry in the data base.

Methods of validation in tables

The validation methods allow the programmer to verify that certain conditions are fulfilled before an action is executed.
In Axapta, methods of validation at two levels can be programmed:

  1. Table
  2. Origin of data of a form

It is important to know that the methods of validation of the tables are executed whenever they are introduced or erase registries. Whereas if the validation is made in the form, it will only work when we are working with that form.

  1. Whenever it is possible, the validation of data must be made in the table.

Methods

The methods of validation in tables are the following ones:

ValidateField

It is executed when we move the cursor from a field from the form to another one, that is to say, when we left a field. It gives back a data of boolean type. If the result is false, the cursor will remain in the field.
The call to the super method () verifies the validation relations, that is to say, relations in a field where the Validate property has affirmative value. Therefore, we must respect the task made by this super method ().

  1. Validations do not have to be codified that can be made with some property. Thus, we will avoid to write code in the ValidateField method if the conditions can be verified with the Validate property of a relation.
ValidateWrite

It is executed before inserting or updating a registry in the table. It gives back a data of boolean type. If it gives back false, the registry is not inserted or updates.
The call to the super method () examines all the fields to verify the value of the Mandatory property. Therefore, we must respect the task made by this super method ().

  1. We will avoid to introduce code that it verifies if a field has value, whenever we pruned to use the Mandatory property.
ValidateDelete

It is not necessary to forget, that often also we want to verify certain conditions before erasing a registry of a table. In order to do this, we used the ValidateDelete method ().
ValidateDelete () is called automatically from forms and is used to verify if the present registry can be erased.
The call to the super method () verifies if there are registries related in tables to DeleteActions of the Restricted type. If that is the case, the super method () gives back false. Therefore, we must respect the task made by this method.

  1. Whenever we pruned to use a DeleteAction, we will avoid to introduce code in the ValidateDelete method.

Structure of the validation methods

In order to maintain a good structure of programming, he is recommendable that the code for the verifications is not located directly in these methods of validation. It is more advisable than we create verification methods that will be called from the methods of validation previously described.
Example of validation method
Boolean validateWrite ()
{
Boolean ret;

ret = checkSomething () && checkSomethingElse ();

return ret;
}
When some of the conditions is not fulfilled, the verification method must make two things:

  1. to present/display to the user an error message
  2. to give back the false value like result

The CheckFailed method (`Message of error') writes the text chain that receives as parameter in the information window (Infolog) and gives back the false value. Therefore, by means of the use of this method, we obtained simultaneously both objective.
Example of use of CheckFailed
Boolean checkSomething ()
{
Boolean ret;

if (! something)
{
ret = checkFailed (`Something is wrong');
}
return ret;
}
We could use the previous structure, but cases exist in which it interests to us to verify the same Something condition, present in the CheckSomething method (), without presenting/displaying no message to the user. In this case we would need an additional method, that verified the condition but that it did not show any message.
Nevertheless, this would not be very efficient, because we would be duplicating the verification code, therefore is more recommendable to create a called method Something (), to which we will be able to call when we want, that it will be in charge to make this verification.
We will have, in addition, to change the CheckSomething method (), so that it makes a call to this new method. The CheckSomething method () we will use it solely when we want to show a message the user.
Example of complete validation
Boolean something ()
{
if (! something)
{
return false;
}
return true;
}

Boolean checkSomething ()
{
Boolean ret;

if (! something ())
{
ret = checkFailed (`Something is wrong');
}
return ret;
}

  1. We can consider a standard of nomenclature of Axapta, the use of the Check area code, in the name of all those methods that make a call to the global method CheckFailed (). Of this form we will know what methods present/display messages in the Infolog window.

Used methods of system more

Next we are going to describe some of the used methods more in the tables, that by their importance deserve a treatment something more exhaustive. The examples of the methods have been obtained from the CustTable table.

InitValue

The InitValue method is executed when we added a new registry. Also it is called automatically from the forms. Therefore, we will use the method to assign initial values or by defect in a new registry.
Example
void initValue ()
{
CustParameters custParameters;

super ();
this.languageId = CustParameters:: languageId ();
this.currency = CompanyInfo:: find () .currencyCode;
}
It is necessary to indicate that the call to the super method () does not do anything.

Insert

The Insert method is executed when a new registry in the table is introduced. It is very important to assure any related transaction to assure integrity the data base. The techniques of control of transactions will be seen in a later chapter.
Example
void insert ()
{
this.setNameAlias ();
super ();
}
If the registry cannot be inserted in the table, the call to the super method () gives back an error.

Update

The Update method is executed before modifying an existing registry in the table. In this case, also it is very important to control any related transaction to assure integrity the data base.
Example
void update ()
{
CustTable this_Orig = this.orig ();

ttsbegin;
this.setNameAlias ();
super ();
this.setAccountOnVend (this_Orig);
if (this_Orig.custGroup! = this.custGroup)
ForecastSales:: setCustGroupId (this.accountNum,
this_Orig.custGroup,
this.custGroup);
ttscommit;
}
In the example the method is used orig (). This one method gives access us to the registry before the update.

Delete

The method delete is executed when a registry is eliminated. It is very important to assure any related transaction to assure integrity to us the data base.
Let us suppose two related tables calls TableA and TableB. If in TableA we have defined a DeleteAction of type cracked (Cascade) with respect to TableB, when a registry of TableA erases erase the registries related in TableB.
For yield reasons, one is due to avoid to write code in the Delete method of these related tables (in the example, TableB). If code has not been added, the cascade erasures can be made quickly by the system database manager using directly instructions of erasure SQL.
Nevertheless, if we added code in those tables (what it can be necessary in some occasions), the system creates an instruction while select and executes the Delete method in all the tables related daughters. Of this form the yield is minor that when we directly used instructions of erasure in SQL.


Thursday, July 26, 2007

What is MST?

What is MST?

I have been with Microsoft for a little more than four years now and twice my team has been involved in an investigation to figure out what MST, as in AmountMST, is short for. Now by writing this blog post I hope to save us from a potential third investigation. Actually this time we found the key to the answer in a help text and it will of course be part of future documentation.

The abbreviation doesn't seem to any kind industry standard, but MST is short for "Monetary Standard".

I have a short explanation of MST if you are not at all familiar about with MST in AX. AmountMST refers to the base currency you keep your records of the system in, i.e. "Company currency". So for example when recording an invoice you keep the amounts both in your company currency, i.e. MST (for example DKK), and the invoice currency, for example EUR.

Check or Cheque

Britsh and English Differences

X++ Blog

This blog is created by X++ team.

10 Ways to Instantly Build Self Confidence

10 Ways to Instantly Build Self Confidence

Development Architect to Solution Architect

How to become a Solution architect from Development architect

The Mythical Team Leader

Russ Finney explains how to be a mythical team leader and chalenges faced by the team lead.

Monday, July 23, 2007

.Net Pod Casts

1- DNR TV
2- .Net Rocks
This is an excellent link to T.V. shows for .Net and other stuff

Tuesday, July 17, 2007

Locked in Journal

The journal locked in functionality prevents direct posting on an account.For example, an Accounts Receivable ledger account should only have postings from a customer set up in the Posting profile form.With Locked in the journal check box selected, there can be no direct posting. If there is direct posting, then the Accounts Receivable ledger account does not represent the Accounts Receivable module any longer, and there are differences on the totals on that account, and on the total of the Accounts Receivable modules.sequentially numbered checks in the bank moduleIf there is direct posting, then the Accounts Receivable ledger account does not represent the Accounts Receivable module any longer, and there are differences on the totals on that account, and on the total of the Accounts Receivable modules.sequentially numbered checks in the bank module.

Wednesday, June 6, 2007

Offset Accounts

Dynamcis AX performs lots of ledger posting using offset accounts. These are some of definitions i have for offset account.

Defention1:
One that reduces the gross amount of another account to derive a net balance. Accumulated depreciation, which is a contra account to fixed assets to obtain book value, is an example of an offset account. Discount on note payable, which is a reduction of notes payable to derive the carrying value, is another example.

Defintion2:
OFFSET ACCOUNT is an account that is setup for elimination of a long or short position by making an opposite transaction.

Reference
http://www.interestsaver.com.au/
http://www.stepforward.net/
http://dynamicsmatters.blogspot.com/
http://www.arkona.com/
http://download-east.oracle.com/

Tuesday, June 5, 2007

Friday, June 1, 2007

Microsoft Dynamics AX Document Management System

Document management system in Microsoft Dynamics AX is used to attach documents, notes or images against specific records. All the documents are stored in DocuValue table with their reference in DocuRef table. In order to enable document management system we have to perform some simple steps.

Open Navigation Pane

Go to Basic -> Setup -> Document Management

Now you can see four options related to document management

Document types

Active document tables

Parameters

Document file extension

Now go open active document tables

Create a new entry (Ctrl + N)

Add your table in the grid and check mark active tab

Open AOT -> Data Dictionary -> Tables -> DocuRef table

open setSmmTable and place an entry of your table over here

void setSmmTable()

{

switch (this.RefTableId)

{

case tablenum(CustTable),

tablenum(VendTable),

tablenum(SalesTable),

tablenum(ProjTable),

tablenum(ContactPerson),

tablenum(smmActivities),

tablenum(SalesQuotationTable),

tablenum(smmMailings),

tablenum(smmBusRelTable),

tablenum(smmTMCallListTable),

tablenum(smmCampaignTable),

tablenum(smmEncyclopediaItems),

tablenum(smmCampaignSelection),

tablenum(yourtablename):

this.SmmTable = true;

break;

default:

this.SmmTable = false;

break;

}


}

Now you can see a document handling icon at the toolbar. You can use this icon to attach documents.

Thursday, May 31, 2007

Starting Microsoft Dynamics AX

Hi,
My name is abdul samad. In this blog i will be talking about lots of microsoft dynamics ax related stuff. I will post my experiences related to Development, Configuration and Implementaion of Dynamics AX. I will share X++ code and we will talk about videos and other stuff available in axapta. you can contact me @ abdulsamadpatel@gmail.com