Jun 14, 2012

What is DLL in AX ?


What is a DLL?

     A dynamic-link library (DLL) file is an executable file that allows programs to share code and other resources necessary to perform particular tasks.

     A DLL provides one or more particular functions. Programs accesses these functions by creating either a static or dynamic link to the DLL. A static link remains constant during program execution while a dynamic link is created by the program as needed.

     A DLL can be used by several applications at the same time. Some DLLs are provided with the Windows operating system and available for any Windows application. Other DLLs are written for a particular application and are loaded with the application.

     DLL files usually end with the extension .dll,.exe., drv, or .fon.

     Kernel.exe, User.exe and Gdi.exe are examples of DLLs with .EXE extensions. They provide code, data or routines to programs running in the Windows operating system.

     DLLs may be found in the Windows directory, Windows\System directory or in an program's directory.


Field level Modified()

The following code is for to compare the  modified field value on form level :

Go to form Datasource(My datasource is JpSampleTable) field level and override the field's modified() as -


public void modified()
{
    if(JpSampleTable.JoinDate < JpSampleTable.orig().JoinDate)
        info("Modified date " +strfmt("%1",JpSampleTable.orig().JoinDate)+ " is less than "+strfmt("%1",JpSampleTable.JoinDate));
    super();
}



Creating a form for lookup

The following code is to performing form lookup for a field on another form..

Step 1 : Create a form (EmplIdLookupForm) with the required fields(Lookup form)
 
  - Override the form level init() and run() as

void init()
{
    ;

    super();

    element.selectMode(emplTable_EmplId);
}

public void run()
{
    FormStringControl callingControl = SysTableLookup::getCallerStringControl(element.args());
    boolean filterLookup;
    ;

    filterLookup = SysTableLookup::filterLookupPreRun(callingControl, emplTable_EmplId, emplTable_ds);

    super();

    SysTableLookup::filterLookupPostRun(filterLookup, callingControl.text(), emplTable_EmplId, emplTable_ds);
}

- Override the forms DataSource Level init() as

void init()
{
    Query   query = new Query();
    ;
    super();

    query.addDataSource(tablenum(EmplTable));

    this.query(query);
}

Step 2 : Override the Lookup caller form field's Lookup() with following code

FormRun formRun;
    Args args;
    ;

    args = new Args(formstr(EmplIdLookupForm));
    args.caller(this);
    formRun = ClassFactory::formRunClassOnClient(args);
    formRun.init();
    this.performFormLookup(formRun);