1 Reply Latest reply on Oct 6, 2014 11:13 AM by philmodjunk

    Script to switch to another person

    ultranix

      Title

      Script to switch to another person

      Post

      I have a contacts table, in which, most of the cases, one contact is responsible for one property. Sometimes 2 persons are responsible for 1 property, so, in order to "switch" to another person, i use such script (screen attached). 
      and it works like a charm to switch between 1st person (who has id_conta and no id_alt) and 2nd person (whose id_alt is 1st person's id conta and has his own id_conta).

      But in rare cases, there are 3 or more people responsible for the property. So how do I "switch" between them? I want to click button and if I'm on 1st person, switch to 2nd, if i'm on 2nd, switch to 3rd, if on 3rd - switch to 4th, if 4th is the last - switch back to 1st.

      How do I have to adjust this script?

      switch.jpg

        • 1. Re: Script to switch to another person
          philmodjunk

          This sounds like you should use a join table to manage what is in fact a many to many relationship. A secondary relationship to a different occurrence of contacts can then use a "primary contact ID" field in properties. You can then "switch" contacts simply by updating this additional contact ID field to be the ID of a different contact in the set of related contacts.

          Contacts|Primary------<Properties-----<Property_Contact>-----Contacts