Using FilePath on a form

  • June 25, 2009
  • 1 Comment

When you want a filebrowser on your form and you only added a field that extends from the Extended Data Type FilePath, you wil get a stack-trace/error message when you click on the folder icon. Don’t panic, there is nothing wrong with your AX. Like the error explains you just need to provide the form with the method filePathLookupTitle.

error_formRun_filePathLookupTitle

1
2
3
4
public LabelString filenameLookupTitle()
{
    return "Select Import File";
}

Normally this should solve your problem.

There are some more methods you can add to control the file lookup:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public LabelString filenameLookupFilename()
{
    return "";
}
 
public FileNameFilter filenameLookupFilter()
{
    FileNameFilter filter;
    filter = ['All FIles','*.*'];
    return filter;
}
 
public LabelString filenameLookupInitialPath()
{
    return "";
}
 
public LabelString filePathLookupTitle()
{
    return "Select Document Path";
}