4 Replies Latest reply on Jun 26, 2012 6:44 AM by philmodjunk

    Relative file reference for container field

    tchabot

      Title

      Relative file reference for container field

      Post

      I am looking for a solution of the following construction:

      in a databse I have a container and a textfield. This textfield is supposed to have a relative file location (like: ..\pictures\image01.jpg) selected from a filelist like explorer. This relative filelocation should be the place for the picture that will be displayed in the containerfield in the same record.

      Anybody used this construction before?

      Thibaud

        • 1. Re: Relative file reference for container field
          philmodjunk

          Define a calculation field with container as the return type. Define the calculation to refer to the text field, using text operators/functions to modify the file path stored in the text field if necessary to get it into the format needed for the container field. (you might need an expression such as: "file:" & TextFieldHere )

          • 2. Re: Relative file reference for container field
            tchabot

            That works fine. Is it possible to have the picture displayed right away? Now I have to double click on it to display.

            • 3. Re: Relative file reference for container field
              philmodjunk

              You may need to use a script trigger on your field with OnObjectSave or OnObjectExit to commit the record and/or refresh the window.

              You could also store all your images that this field might select in a related table with one container to each record. Define the relationship to use the text field as the match field to a corresponding text field in the related table. (It does not need to store the filepath, these text fields can now store names or descriptions if you wish.) THen you place the container field from this related table on your layout in order to select different images.

              • 4. Re: Relative file reference for container field
                philmodjunk

                Hmmm, just realized why you had to double click the container field.

                Use Insert Picture to insert an image field with the save a reference option. Then use either getasText ( containerfield ) in the DataViewer (if you have FMP advanced) or use a calculation field that returns text but refers to your container field as the sole term of its calculation. Put this field on the layout next to your container field.

                Note the format needed for an inserted picture to display in the container field. Your calculation needs to reproduce this format.