3 Replies Latest reply on Feb 3, 2017 9:39 AM by nicolai

    Save URL from File Browser dialog into a SQL Server text field

    wakey

      Hi, I'm developing a Layout that gets it's data from a SQL Server Database table.  I want to click a button which runs a script and opens a dialog box that allows the user to select a network drive, folder(s) and then a file.  When the dialog is closed it returns the full path for the selected file and the script can then save this into field in the SQL Server database.

       

      I've come across the Insert File, Insert image functions but I can't seem to get the output of these functions to save to a text field in the SQL Server Database field.

       

      I'm sure this is very simple but I can't seem to find any examples.

       

      Help!

       

      Thanks in advance

       

      Mark.

        • 1. Re: Save URL from File Browser dialog into a SQL Server text field
          nicolai

          "Insert File" should be used with a container field as its target. After the file is inserted in the field use GetAsText() on the field to get the file path

          • 2. Re: Save URL from File Browser dialog into a SQL Server text field
            wakey

            Hi yes, I did start off looking down this route, but as I'm using external database tables SQL Server, I couldn't add a container type field to the external table.  It doesn't give me the option.  I did create a FileMaker table and link it.  The FileMaker table had a link to the SQL Server Table and a container field.  However, the GetAsText only seemed to return the filename not the full path, i.e. \\servername\volumes\directories\filename.extension  Maybe I'm using the wrong settings for Insert File and GetAsText(attribute).  Do you have an example of the script lines?

             

            It seems to get very complicated when external databases involved, I didn't want the FileMaker database to store anything and then just keep growing in size for no reason.  We are trying to save references to image files in the SQL Database which just sounds so simple, but is becoming a nightmare.

            • 3. Re: Save URL from File Browser dialog into a SQL Server text field
              nicolai

              I forgot that you are using ESS. You are on the right track - FileMaker table and container field. You can make your field global to save space. For "Insert File" tick "Store only a reference to the file" option. This should give you path with GetAsText(). I think, the latest versions of FIleMaker actually return a list, so you might have to get the path from the result of GetAsText() with GetValue().