Thursday, April 23, 2015

How to Browse a File in Form Using X++ in AX 2012

Follow the below step to add  Browse Functionality in Form

Step1:-  Create a Form
            > Add a StringEdit in Design
            >Assign a EDT Property as FilenameOpen

Step 2:-
           Add the below Methods to the form in order to complete the functionality

  FilenameFilter filenameLookupFilter()
{
    #file
    return [WinAPI::fileType(#xpo), #allfilesName+#xpo, #allFilesType, #allFiles];
}
-----------------------------------------------------------------------------------------------------------
str filenameLookupTitle()
{
    return "Select a trade agreement to import";
}
------------------------------------------------------------------------------------------------------------

str filenameLookupInitialPath()
{
    return "";
}
-------------------------------------------------------------------------------------------------------------

str filenameLookupFileName()
{
    return "";
}
----------------------------------------------------------------------------------------------------------------

All Done !!!!!!!!!
Now you can browse the file in Form

Method 2 :-

Step 1:-  Create a Form
            > Add a StringEdit in Design
            >Assign a EDT Property as FilenameOpen

Step 2:- Override the Lookup method on StringEdit Control.

public void lookup()
{
    FilenameOpen    file;
    Filename        path;
    Filename        name;
    Filename        type;
    #File

    file = WinAPI::getOpenFileName(element.hWnd(),[WinAPI::fileType(#xlsx),#AllFilesName + #xlsx],path,'Select ...',"",name + type);
    if(file)
    {
        StringEdit.text(file);
    }
}


2 comments:

  1. https://www.youtube.com/playlist?list=PLWSxgDbjVWTjxvgnaAZ0iK8o5dYHAYhrq

    Collection of Microsoft ERP Clips || ERP Licensing, Technical, Functional ,Manager Learning Videos Listing

    ReplyDelete

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// ...