4 Replies Latest reply on Nov 11, 2015 12:42 PM by weedonpaul

    Relationship nightmare

    weedonpaul

      OK this will be as clear as mud

       

      I have a table called clients with details about our clients

       

      for our clients we do many things organise events (table called events) write press releases and articles (table called content) etc

       

      I have a portal on my clients layout to Actions, actions are a list of jobs that need to be done some are linked to events and some to content

       

      I have a button on my clients page to add a new action I eventually want this button on multiple pages

       

      I want to create a new action by first asking weather it is an event action or a content action for this I have written a script which works.

       

      once I know whether it is an event or a content related action I want to look through the list of events or content that relate only to that client and then assign that action to that event or content.

       

      relation ships are as follows 

      Clien::clientID = Actions:clientID

      Actions::ActionID = Content:: action ID

      Actions::ActionID = Events:: action ID

       

      I'm not sure this is right - each event/content can have many actions but if I use eventID and ContentID and Many other JobsID it becomes unworkable.

       

      I have it all working except I get a list of all content/Events even those not related to that client. I am  worried I've got down a wrong path so would be interested to here how others would solve this problem?

        • 1. Re: Relationship nightmare
          wimdecorte

          weedonpaul wrote:

           

           

          Actions::ActionID = Content:: action ID

          Actions::ActionID = Events:: action ID

           

           

          This does not look right.  An action belongs to Content or an Event, not the other way around; so an Event would never store an Action ID, nor would a Content record.

           

          It is not clear to me where you are stuck (except the above).  Are you struggling to display a list of Events for a given client so that the user can pick one to assign the Action to?

          • 2. Re: Relationship nightmare
            weedonpaul

            I've been giving it some more thought, I think I need to set up a unique ID in Actions that can be gotten from events/content or anything else.

             

            because events/content etc can have many actions

             

            I was doing it wrong in terms of one record trying to hold many action ID's

             

            I'm going to try and sort that out then get back

             

            does that make sense?

            • 3. Re: Relationship nightmare
              wimdecorte

              No.

               

              Sure, Actions need their own unique ID, but no: that ID should not be "gotten" from events/content.  The link to and from Content to Actions is by the Content ID stored with the Action.  Same for the Events.

              • 4. Re: Relationship nightmare
                weedonpaul

                Ok I've sorted out the relationship stuff to a point but have another question around it but think it will be easier if I start explanation again so will re explain it all in a new thread