6 Replies Latest reply on Jun 23, 2011 7:37 AM by yuichim

    Custom function question

    yuichim

      Title

      Custom function question

      Post

      I have two tables:  Account  and  Contact with a relationship   Account::maincontactID -> Contact::ID

      My question is if I wanted to create a custom function to pull the FirstName from Contact table by looking at Account::maincontactID, which functions should I use?
      I am a bit lost...

      Any help much appreciated...

        • 1. Re: Custom function question
          philmodjunk

          No function should be needed for that.

          With Contact::ID = Account::MaincontactID

          You can simply refer to Contact::FirstName from any layout based on Account and you'll access the first name for the contact record that's linked to the current account record on that layout. You can even put the FirstName field from Contact directly on this layout if all you need is to display the name of the contact for the current account.

          • 2. Re: Custom function question
            yuichim

            Thanks Phil!  I forgot to mentioned that I wanted to use the custom functin on the layout that has no relationship assigned to the account nor contact.
            Would it still be possible to write a custom function ?

            • 3. Re: Custom function question
              philmodjunk

              Why not just add the relationship?

              I don't think a custom function would work very well for this since without an established relationship, you'd need to perform a find to access the correct record. I think we discussed such a scripted report on another thread if memory serves correct.

              • 4. Re: Custom function question
                yuichim

                I was told once that if you have many relationship built the performance will decrease so I thought of creating a custom function to handle the relationship...

                Is that true though?

                • 5. Re: Custom function question
                  philmodjunk

                  I don't think the total number of relationships in your file will significantly affect performance.

                  The complexity of your layout--which could require that many relationships be used for the layout (not the total in your file) might be a factor. (Summary fields, unstored calculations, conditional formatting and some popup menus with conditional value lists are all factors that can slow system responsiveness.)

                  But using an alternative approach will either be much slower or will update in response to changes much less frequently as well as requiring a greater complexity in the design of your system.

                  • 6. Re: Custom function question
                    yuichim

                    Phil,
                    Thank you for your response.  I will put the relationship in place. Smile