web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Multiple choice in file import

(1) ShareShare
ReportReport
Posted on by 1,421

Hi all,

I need to implement a dialog that provides, a user's, the possibility to choose more than one file, in order to run an unique import procedure.

How can I get what I want?

*This post is locked for comments

I have the same question (0)
  • Anton Venter Profile Picture
    20,346 Super User 2025 Season 2 on at

    Hi Giuseppe,

    How do you determine from the file which import to run?

  • Suggested answer
    Community Member Profile Picture
    on at

    Check out this link, it should be what you are looking for

    http://dynamicsuser.net/forums/p/31783/171187.aspx

  • Community Member Profile Picture
    on at

    Try:

    WinAPI::getOpenFileName(0, ['CSV', '*.CSV'],  @'C:\', 'Select a file', '', '', 512);

    512 flag allows you to select more than one file.

  • Douglas Noel Profile Picture
    3,905 on at

    Hy,

    I don't know if this will really work in all cases. The File names are #0 delimied each and the last hat two #0 entries. (historical c/c++string arrays). I'm not sure what the kernel will transfer from the bindata buffer to the string? But you can try. Maybe it works.

    But why not use .NET class

    see the following entry (sorry for the 'google')

    groups.google.com/forum

    regards

    Douglas

  • Giuseppe Caradonna Profile Picture
    1,421 on at

    Sorry M Z, but the result of the getOpenFileName() method is a string that contains the parent folder of files that I have selected. I need a list of the selected files...

  • Douglas Noel Profile Picture
    3,905 on at

    Hi Giuseppe,

    I thought as much, therefore  my apprehension.  So give the .NET class a chance (the link is a full link, don't know why it is abbreviated)

    think that can be the better way. But haven't tested.

    Please give a short statement if the multislect using the .NET class can be used.

    regards

    Douglas

  • Verified answer
    Anton Venter Profile Picture
    20,346 Super User 2025 Season 2 on at

    Hi Giuseppe, here is a job with code that I believe is what you are looking for.

    static void AV_MultiFileSelectDlgTest(Args _args)
    {
        int             idx;
        int             cnt;
        boolean         result;
        System.String[] files;
        Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
    
        dlg.set_Multiselect(true);
        dlg.set_DefaultExt(".txt");
        dlg.set_Filter("Text documents|*.txt|All files|*.*");
    
        result = dlg.ShowDialog();
    
        if (result)
        {
            files = dlg.get_FileNames();
    
            cnt = files.get_Count();
    
            for (idx = 0; idx <= cnt; idx++)
            {
                info(files.get_Item(idx));
            }
        }
    }


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans