6 Replies Latest reply on Dec 17, 2013 4:42 AM by MalcolmTodd

    Referring back to a Field

    MalcolmTodd

      Title

      Referring back to a Field

      Post

                I am building a club membership database using basicFM Pro 11.

                I have 2 tables:

                tblPeriod which contains, among others, a field "MembershipYear"

                tblMemberDetails which has fields e.g. Surname

                The tables are linked through a unique "ClubNumber"

                lytSelectYear is a layout based on tblPeriod, the user is asked to input a Year which is valid for the records in "MembershipYear" field. A script, scrGetYear, performs a Find and the results are displayed in the Body of lytMembers (based on tblMemberDetails) by including the Surname field.

                I want to display in the Header of lytMembers the inputted Year. (Inserting the field "MembershipYear" results in the first record of tblPeriod being displayed)

                How may I achieve this?  Many thanks for any suggestions, Malcolm Todd

            

        • 1. Re: Referring back to a Field
          SteveMartino

               Just guessing, are you in List View?  If the field is in the header for List View, it will only show from the first record.  If you're in form view, it changes as you change the record

               Edit: Let me add, in List View, the first record shows.  But if you scroll down and click into any field or even on the record page of a different record, the field will change.

          • 2. Re: Referring back to a Field
            MalcolmTodd

                 Thank you for your answer Steve.

                 Yes, I am in List View, which does display the relevant records as I want. My objective is to produce (for subsequent printing) a list of surnames of people who were members in the inputted year and to display that chosen year at the top of the list .

                 Unfortunately, putting the "MembershpYear" field in the Header of the layout, whether in List or Form View does not achieve this, as you say it simply shows the first record in that field rather than displaying the value entered in lytSelectYear.

                 If you have further suggestions I would be most grateful.

                 Malcolm Todd

            • 3. Re: Referring back to a Field
              philmodjunk

                   SInce you have performed a find for records matching that value, a field showing data from the first record (actually the current record when you are in Browse mode), should show the correct data.

                   But you can also put the data you want to show in a global field or variable and then put that global field/variable in the header to show the data. Your script can assign that data to the global field or variable to make that happen.

              • 4. Re: Referring back to a Field
                MalcolmTodd

                     Thanks for your suggestions Phil.

                     Because there is a One to Many relationship between Surname and MembershipYear , even after a Perform Find the first record is not always the same as the inputted year.

                     However I have had more success with your idea of a Global field and things are working as I wanted. Many thanks. I now want to trap a potential error where the global field does not match the "MembershipYear" from tblPeriod. Any ideas?

                     Regards,

                     Malcolm Todd 

                • 5. Re: Referring back to a Field
                  philmodjunk

                       What you describe has me puzzled. If you are performing a find, the find criteria should omit the records with different values in the membership year field. Perhaps you are performing your find on the wrong table?

                  • 6. Re: Referring back to a Field
                    MalcolmTodd

                         You are exactly right Phil - I was performing the find on the wrong table, which resulted in me finding a solution that was far too complex for a simple problem. Lesson learned - keep it simple!

                         I am very grateful, so many thanks again.

                         Malcolm Todd