Showing posts from February, 2013

Dynamics AX – Passing parameters between object – What is args??

Hi Friends,

ARGS is your friend in the world of AX (me also :) ). It allows you to pass records, the calling locations (form, report, query etc) , ENUMS and the list goes on!  
Simple declaration of args

Args  args = new Args();

Now lets try passing args an record.

select firstonly custTable where custTable.AccountNum == ‘XXXX’

Now lets view a snippet of code that passes in a record and runs a report using the record passed in. 
I- Create an instance of the report run class.
Create a new Args instance to hold all of this information. 
Pass the name of the report.
Instantiate the report run object and call the init and and run methods of the report.

II- Next override the init method of the report and put a condition that checks to see if a record was passed to the report from the args object. If so do not allow the user to be interactive with the report and sent the report straight to the screen.

III- Set a report variable eHeader to the record that w…

Error: Error executing code: Wrong argument types for comparison. (C)\Classes\xRecord\toolTipField (C)\Classes\FormDataObject\toolTip (C)\Classes\FormStringControl\ToolTip

Error: Error executing code: Wrong argument types for comparison. (C)\Classes\xRecord\toolTipField (C)\Classes\FormDataObject\toolTip (C)\Classes\FormStringControl\ToolTipI faced a issue when I select a record on form,Error executing code: Wrong argument types for comparison. (C)\Classes\xRecord\toolTipField (C)\Classes\FormDataObject\toolTip (C)\Classes\FormStringControl\ToolTipSolution:Just check your EDT which is your primary key of table. check the relation.Basically this error will come when you change the field name in table it will not update in your EDT relation.- Harry

List view Control in Dynamics AX

Hi Friends,

Here is step by step Tutorial for ListView FormControl.  During this tutorial we create a separate Form (just for testing this tutorial).

ListView Control helps you when you want to select multiple records from a list of records see below image

Follow this steps

Step 1: Create a new Form and name it “_ListView”
In design Node, Add a new Control called ListView and name it as “LeftListView” as shown below.

By default -AutoDeclaration property of the ListView will be “Yes”.(Because you have to access this in your code for insert/Access/Delete items from ListView)
Now lets learn some important properties of the listView. Change the View type property from “Icon” to “Report” s shown below.

Save the form and now let’s add coulmns to the list view. Since we have set the autodeclaration property of the LeftListView to “yes”, we can use this control inside the code.

Step 2: Override the init() method of the Example_ListView form and add the below lines of code to add columns to t…

How to pass values between form and report

How to pass values between form and reportHere is for example the code of the button that calls the report:
void clicked ()
    Args     args;
    ReportRun          reportRun;
    args = new Args();;
    args.parm( LogId  );
    reportRun = classfactory.reportRunClass(args);
    args.parmObject( args );
in the init method of your report try this:
public void init()
    if( element.args() )
        logId =  element.args().parm();
then you can use this parameter in your report form example: 
public void executeSection()
    if  ( employee_1.LogId == logId)
        emplId = employee_1.empId;
    if ( logid == "1")
        emplId = DropHoliday_1.EmpId;
You can use this logic in your code for many purpose.