9 Replies Latest reply on Dec 13, 2013 6:50 AM by cwiltgen86

    Set a field to display specific information.

    hafiz5198

      Hello there!

      I have a question to ask.

      I'm creating a database for a tuition centre and at the student's registration layout, I've put a some checkbox to choose the subjects. Down there is a field where it will total the subjects selected and I've managed to do it right. The problem is that the fees are different depending on the number of subjects u choose (e.g. 1 subject = $50, 2 subjects = $90, 3 subjects = $135 and so on) and I don't know how to set a new field so that it will display the fees depending on the total of subjects selected (which is in another field). Let's say if "Field A" displays number "3", then "Field B" displays "$135". In short, the question is "How to create 'Field B'?"

       

      Hope the professionals could help me although there's a lot of grammatical errors here.

      Thanks.

        • 1. Re: Set a field to display specific information.
          MichaelManousos

          You can have a table with two fields record1 fieldA=1 fieldb=$50, record2 fieldA=2 fieldB=$90 etc then you make a lookup field in the other table with a relationship with field A

          1 of 1 people found this helpful
          • 3. Re: Set a field to display specific information.
            AlanStirling

            Hi Hafiz

             

             

            It might be easier to use the 'Choose' function in a second calc field.

             

            Your new calc would look something like this;

             

            Choose ( Count of Subjects Field ; 0 ; 50 ; 90 ; 135 ; 160 ; 190 ) etc.

             

            This is simpler than adding a separate table and offers just as much flexibility.

             

             

            Best wishes - Alan Stirling, London UK.

            • 4. Re: Set a field to display specific information.
              hafiz5198

              Thanks Mr. Alan. Actually I also tried to create a script which is something like this:-
              If Field A = 1
                   Set field B = 50

              End if
              If field A = 2
                   Set field B = 90
              End if

               

              But the point is that I have to create another button (which I named 'Calculate') to perform the script and your answer is very much helpful for me as it does not need any buttons and can instantly calculate automatically thus preventing any "Forgot to click the button" scenes from happening.
              Thanks again Mr. Alan.

               

              "Hafiz - 15 years old - Malaysia"

              • 5. Re: Set a field to display specific information.
                robwoof

                If you put an Auto-Enter Calculation on Field B, and de-select the "Do not replace existing value of field (if any)" option, you will get what you need. Use whichever option of the above suggestions you prefer as the calculation, and the replacing will update it whenever FieldA is updated.

                HTH

                Rob

                1 of 1 people found this helpful
                • 6. Re: Set a field to display specific information.
                  hafiz5198

                  Hi Mr. Alan.

                  I tried using your steps and it worked. Thanks again. Now let's say if I want to register a students profile, before I can choose the subjects, I have to choose a drop-down list of the students age because the fees varies depending on age. E.g.---

                  11 and 12-year-old students     :- 1 subject=$50

                                                                  2 subjects=$90

                                                                  etc

                  13, 14 and 15-year-old students:- 1 subject=$60

                                                                   2 subjects=$110

                                                                   etc

                  So, how do I do this by applying your steps above. Or must I do it in a different way?

                  Really hope you can help me.

                  Thanks.

                  • 7. Re: Set a field to display specific information.
                    MichaelManousos

                    I would do it with portals and filtering

                    • 8. Re: Set a field to display specific information.
                      erolst

                      Hi Haf –

                       

                      try

                       

                      Let ( [

                      age = registrationAge ; // your field

                      p = Case (

                          age > 10 and age < 13 ; List ( 50 ; 90 /* ; etc …*/ ) ;

                          age > 12 and age < 16 ; List ( 60 ; 110 /* ; etc …*/ ) ;

                           "Unknown age" // THAT shouldn't happen

                      ) ;

                      c = ValueCount ( registrationCheckboxField )

                      ] ;

                      GetValue ( p ; c )

                      )

                       

                      btw, Michael is right about using related tables. Check boxes and value lists are handy data entry tools, but in the long run you'll find that you cannot do any reporting on data you have stored as a list in a single field.

                       

                      At some point you will notice that you need more flexibility, like (at least): 

                       

                      Student --> Registration ---> StudentCourse (aka CourseEnrollment) <-- Courses

                       

                      which are probably only the lightweight versions of tables that store year-/term-specific data (so each topic in each year is covered by different courses, and for a registration at a certain point in time you can only select courses that are actually offered).

                       

                      Anyway, good luck with your project!

                      • 9. Re: Set a field to display specific information.
                        cwiltgen86

                        The other issue is everytime the price changes you have go in and hard code the new prices.  with a related table you can update easily.