3 Replies Latest reply on Dec 21, 2013 4:09 PM by philmodjunk

    Replace field contents with another field match

    ClayReed

      Title

      Replace field contents with another field match

      Post

            

           GraphicResources table 

           I am trying to replace the field (Container) contents with another field (Container) contents when a field match occurs. 

           In the Graphic Resources table I have a container field for a graphic Image (GraphicImage) and a field for a Graphic Identifier (GraphicIdentifier) - this is 2 letters an a number. The user adds the graphic identifier and adds a jpg graphic to the GraphicImage container.

            

           CollateralResources

           On this layout I have a Container field (ColateralGraphicsA) and a CollateralGraphicIdentifier field as well. This identifier field pulls from a value list based in the GraphicResources table -  (GraphicIdentifier) field.

            

           I would like to select the drop down list on the CollateralGraphicIdentifier field and when a selection occurs (BG1 - shown) it will match the field in the GraphicResources table and set the container field in the CollateralResources table with the image from the GraphicResources container field.

            

           Here is the script I am trying that does not work:

           If [CollateralResources::ColateralGraphicIdentifier = GraphicResources::GraphicIdentifier]

             Set Field [CollateralResources::CollateralImageA; GraphicResources::GraphicImage]

           End If

      newjpg.jpg

        • 1. Re: Replace field contents with another field match
          philmodjunk

               No script should be needed and you can delete the ColateralGraphicsA field from your database. Given the relationships that you have, you can place the container field from GraphicResources on your layout in place of it.

               Then format the _fkGraphicResources field with a drop down list or pop up menu of values from the GraphicResources table. Specify _pkGraphicResources as field one for the value list and your Graphic Identifier field from this table as field two. You can set it up to hide the pk field and just show the graphic identifiers in the value list.

               This is the "beginner level" way to do this. More sophisticated options for selecting a graphic are possible, but they all are different ways for taking the graphic identifier and entering the PK field from GraphicsReources into your fk field in order to establish the needed link such that the container field from Graphic Resources displays the correct image.

          • 2. Re: Replace field contents with another field match
            ClayReed

                 Thanks Phil. One thing that I omitted is that I could have two graphics in a record (double sided - shown in the uploaded image) and they could be different. That is why I had two Container fields (ColateralGraphicsA & ColateralGraphicsB) in the CollateralResources table.

            • 3. Re: Replace field contents with another field match
              philmodjunk

                   But you don't need those fields for two graphics. You can have two relationships to two Tutorial: What are Table Occurrences? of the GraphicsResources table.

                   Either that or set up a many to many relationship between the two tables as is also possible. This can be done with either a multi-value key or a join table to serve as the link between the two tables.