1 2 Previous Next 18 Replies Latest reply on Jun 18, 2016 1:58 AM by jrenfrew

    How to Ensure Unique Entries in a Join Table

    Razor

      I currently have a join table and I need to be able to prevent multiple occurrences of the same information in the join table.  Lets say I have;

       

      Table A

      ID     Color

      1     Red

      2     Orange

      3     Yellow

       

      Table B

      ID     Shape

      1      Circle

      2     Square

      3     Triangle

       

      In my join table I only want there to be one occurrence of a color and a shape i.e, Red Circle, Red Triangle, Orange Circle, etc.

       

      Join Table
      ID     Table A ID     Table B ID

      1          1                   1

      2          1                   3

      3          2                   1

       

      The only way I can think of preventing duplicates is to create a calculated field to concatenate Table A ID and Table B ID and in my validation have that set to unique values only. 

       

      Join Table
      ID     Table A ID     Table B ID     ComboID

      1          1                   1                    11

      2          1                   3                    31

      3          2                   1                    21

       

      Is this an acceptable method?  Is there a better or "right" way of doing this?

      Thanks!

        1 2 Previous Next