1 2 Previous Next 26 Replies Latest reply on Aug 9, 2016 8:42 AM by User26869

    if and else if

    Mosa

      Hello!

      Sorry in advance if I don't use the correct lingo.

      I have a table of Contacts that relates to either venues, schools, funding or international.

      Contacts and Orgs.jpg

      I am trying to create a button on the contacts layout that allows you to go through to the related record of the organisation the contact works for. But that could be either a venue, school, international or funder.

      I have a field on the contacts table which categories the contact into 'venue contact', 'school contact' etc etc

      I am trying to make a script on the button that allows me to go to a related record depending on what the category field says.. so far I have come up with...

      else if.jpg

      but it doesn't work for any of the schools, funder, or international it only works on the venues contacts.

       

      Any advice?

        • 1. Re: if and else if
          beverly

          Study the Go to Related Record script step:

           

          notice the Layout?

           

          You can specify a layout but it must be based on the table/table occurrence that IS the related reference. And your script appears to be using this correctly.

           

          However...

          by your RG (relationship diagram), you have COPIES (table occurrences) of the same table, but with DIFFERENT relationships.

           

          I suggest you make the links between the first "Contacts 2" and each of the other tables. Since the Contacts 2 is the layout you are ON, the GTRR must use that context to go to the other tables/layouts.

           

          Contacts 2::fkey_venues >-- Venues::idx_venue

          Contacts 2::fkey_schools >-- Schools::idx_schools

          Contacts 2::fkey_international >-- International::idx_international

          Contacts 2::fkey_funders >-- Funders::idx_funders

          .....

           

          It will look like a squid (one head, many legs). Also called Anchor-Buoy.

           

          But you start from Contacts 2 and can go to the various related records/tables/layouts.

           

          beverly

          1 of 1 people found this helpful
          • 2. Re: if and else if
            Mosa

            Hi!

             

            Thank you for this..

            I have tried to use the Contacts 2 table to connect to the venues, schools, international and funders but it won't let me connect any after the venue table. It says..

             

            Which led me to believe I needed to have multiple copies of the contacts table.

            • 3. Re: if and else if
              beverly

              can you print the entire graph (to PDF) and attach? there is something else going on.

               

              beverly

              1 of 1 people found this helpful
              • 4. Re: if and else if
                Mosa

                • 5. Re: if and else if
                  beverly

                  Thank you! You have relationships to Bookings and that is why you have the error.

                  Perhaps you need to re-think the entire diagram

                   

                  I would think that "bookings" is a JOIN table between Contacts and 'locations' (venue, schools, etc.)

                   

                  And perhaps the problem is all the locations in separate tables.

                   

                  OR perhaps you have the correct structure, but need to NOT go from a layout based on Contacts, but from a layout based on Bookings.

                   

                  beverly

                  1 of 1 people found this helpful
                  • 6. Re: if and else if
                    User26869

                    Hi Mosa

                     

                    When you link Contacts 2 with Schools, you "close a loop" from Contacts 2 to Contacts 2. If you follow the paths:

                     

                    Contacts 2 >-- Schools >-- Bookings 3 >-- Venues >-- Contacts 2

                     

                    That is why you get this error.

                     

                    If you think in terms of the context of each layout as Beverly pointed out, it helps seeing for which use you need new Table Occurrences, or copies.

                    In your case I would cut the link of Contact 2 and Venues and add a Contact TO on the right of Venues that links the Venues and the Contacts. Because it would not be the same TO, you would stop getting this error when linking Contacts 2 and Schools.

                     

                    I hope I'm making sense!

                     

                    Chloe

                    • 7. Re: if and else if
                      Mosa

                      Hi Beverly,

                      The 'locations' make bookings of a particular tour, so the contacts are not actually related to the bookings.

                      I have to separate the 'locations' as they have different fields.

                      The bookings layout shouldn't really have anything to do with the contacts

                      :S

                      • 8. Re: if and else if
                        Mosa

                        So are you saying I create a new contacts occurance that the venues table relates to. Then the 'contacts 2' which is actually the table for the layout contacts is left alone?

                        Tell me if I am way off track!

                        • 9. Re: if and else if
                          User26869

                          Well, I might have been too quick in my answer! I thought only Schools were the organisations you needed. Sorry for the confusion!

                           

                          From Contacts 2 (your layout), you need access to Venues, Schools, International and Funders, if I understand correctly.

                          Now that I think about it, I would maybe create new TOs of Venues, Schools, International and Funders and link them to Contacts 2, but not link Contacts 2 directly to the "main" TOs for Venues, Schools, etc

                          That way you don't change anything relationships to your bookings table.

                           

                          Chloe

                          • 10. Re: if and else if
                            Mosa

                             

                            Like so?

                            I still cant make the button with the script work unless it is directing your from a venue contact to a venue page. Which tells me that the actual calculation on the script may be incorrect if it is only listening to the first line.

                            • 11. Re: if and else if
                              User26869

                              Yes, exactly like so.

                              I would have said your script would work in this case!

                              You might need to verify the values of the Category field to make sure they exactly match your set of statements. Make sure that your layout is indeed based on Contacts 2.

                               

                              Good luck

                               

                              Chloe

                              • 12. Re: if and else if
                                Mosa

                                Thank you!

                                I now have a working button and all of the locations are more smoothly connected to their contacts.

                                 

                                Right, now for the next challenge... Bookings!

                                 

                                Thank you everyone

                                • 13. Re: if and else if
                                  richardsrussell

                                  Mosa, this is not a response to the question you actually posed but a bit of completely gratuitous advice, which you may feel free to ignore if you wish.

                                   

                                  You appear to have separate tables for Venues, Schools, Funding, and International. I don't know what each of those things represents in your database system, but Venues and Schools at least look as if they may well be different flavors of what's basically the same thing. (This suspicion on my part would've been more solidly supported had I seen other tables like Companies, Churches, Families, etc., so I may be off base in thinking that Venues and Schools are simply different kinds of locations.)

                                   

                                  Nonetheless, IF they are, you might find it more efficient to just have a single table called Locations (with name, address, website, etc. data), and a "Type" field within it that permits values such as Venue, School, International, etc. Within the Locations table, you could create Calculation fields such as

                                       idx_school = If ( Location Type = "School", idx_location, "" )

                                       idx_venue = If ( Location Type = "Venue", idx_location, "" )

                                  Those would then serve as the keys that other tables could use to link to all locations of the particular type you desire.

                                  • 14. Re: if and else if
                                    Mosa

                                    Hi Richard,

                                     

                                    No any advice is gratefully received! It took me a long time to decide to separate the tables and this is because within ‘venues’ there are multiple types of venues such as festival, library, rural; within ‘schools’ there are educational organisations, collectives and schools; International will have its own subcategories soon also. Each of these type of location have some similarities but there are quite a lot of unique factors that I thought in the end would just be easier to be in different categories so I didn’t have to use a tab system.

                                     

                                    Funding will not be an option to be a ‘location’ for a booking.. only Venues, Schools and Internationals will be an option for a booking location.

                                     

                                    However the issue I have now.. is I have the tables Tours, Bookings, Venues, Schools and International.

                                    Tours is a parent table to Bookings as there are many bookings per tour.

                                    However per booking there is only ever ONE Venue OR School OR International.

                                    So far I have created a relationship of:

                                    (Venues Tbale) Idx_venues = idx_venuesB (bookings table)

                                    (Schools table) idx_schools = idx_schoolsB (Bookings table)

                                    (Int table) idx_international = idx_internationalB (bookings table)

                                     

                                    When creating a new booking I go via the tour table to bookings to add new.

                                    I have a tab with three headers (venues, Schools, Int)

                                    If the new booking is in a venue I then go to the venue tab header, type in the venue name into a field that is linked to ‘Venues:: Organisation’ which should be a drop down of all the venues to choose from.

                                    Ideally I then want the address and all other core details to auto enter into the relevant fields but I can’t make it happen.

                                    I even tried an ‘update’ button for one I have selected the venue that contains lots of ‘set field’ calculations.

                                     

                                    Any ideas? I am sorry if that makes no sense!!

                                     

                                    Many Thanks

                                     

                                    Mosa Mpetha

                                    Administrator

                                     

                                    Working days: Monday, Wednesday, Thursday

                                     

                                    <http://www.tutti-frutti.org.uk/>

                                     

                                     

                                    A company worth watching. The Observer

                                    WiLd is that rare event – a genuine theatrical “must see”. – Yorkshire Post (5 stars)

                                     

                                    tutti frutti, Shine, Harehills Road, Harehills, Leeds LS8 5HS

                                    tel: +44 (0)113 388 0027 follow us twitter<https://twitter.com/#!/tuttifruttiprod> and like us on facebook<http://www.facebook.com/tuttifruttiprod>.  www.tutti-frutti.org.uk<http://www.tutti-frutti.org.uk/>

                                     

                                    Future Productions

                                     

                                     

                                    ·          Underneath a Magical Moon by Mike Kenny for 3-7's – a co-production with York Theatre Royal.  Touring nationally from October 2016

                                     

                                    ·          Ugly Duckling by Emma Reeves for 3-7’s – a co-production with York Theatre Royal.  Touring national and internationally from October 2017.

                                     

                                    tutti frutti productions is a Company Limited by Guarantee and a Registered Charity. Registered Office: Shine, Harehills Road, Harehills, Leeds LS8 5HS.  Registered in England and Wales. Company Registration No. 4267423. Charity No. 1120663

                                     

                                    Before you print think about the ENVIRONMENT

                                    1 2 Previous Next