Log In    |    Knowledge Base    |    4D Home
Tech Tip: Selecting a Document Using Open Dialog
Published On: September 9, 2004

You can select files from the Open Document dialog using the Select Document command. This command returns the name and path to the files that you selected. Unlike Open Document, this command does not open the file. You can select multiple files from the Open Document dialog and retrieve the path to the files. This command takes up to five parameters: Select document (directory; fileTypes; title; options{; selected}) and returns the name of the document. You can pass an optional selected parameter which is an array that will store the pathnames of the files you selected when choosing multiple documents. Below is a sample code on how to use this command:

ARRAY TEXT($marray;0)
$Dname:=Select document("";"*";"Select Document";Multiple files ;$marray)

The first parameter (“”) makes the current directory the default document directory. The second parameter (“*”) will allow you to display many types of documents. The third parameter (“Select Document”) is the title of the dialog and the fourth parameter (Multiple files) is the selection option. And the last parameter ($marray) is an array where the pathnames of the files selected will be stored.