5 Replies Latest reply on Apr 18, 2010 11:26 AM by Ray

    Field Calculation problem~

    Ray

      Title

      Field Calculation problem~

      Post

      Dear all

       

      I have build up two field, one is for imperial and the other one is metric, how can I set up the calculation function to build its relation?

      For example, if I type 1 inch in imperial field, the metric field will automatic show up 2.54 cm. In opposite, if I type 2.54 cm in the metric field, the imperial field will show up 1 inch.

      I have try to use the calculation function in metric field "imperial field= metric field / 2.54". but the problem is I can not type the number in the imperial field and then calculate back.

      How can I solve this problem?

       

      Thanks for your help

       

      Ray

        • 1. Re: Field Calculation problem~
          goldensunflakes

          If I understand you right, this is how I did this for a feet/meter conversion for my database.

           

          You need four fields.

          The first one is lenght_n (number; where someone enters the length)

          The second is lengthUnit_t (text; where options from a value list allow "imperial" or "metric"

          The third one is lengthMetric_c (a calculation; If(lengthUnit_t ="imperial"; length_n *.304799;length_n)

           the fourth is lenghtImperial_c (a calculation; If(lengthUnit_t ="metric"; length_n *3.28084;length_n)

           

          a person enters in the length and the unit using the first two fields and the alternative lengths are calculated by the last two.  You could combine the last two fields into a single field using a series of if statements.

          • 2. Re: Field Calculation problem~
            raybaudi

            Ray wrote:

             

            How can I solve this problem?


            You can stay with your two number fields...

             

            Simply add these calculations into their option of Auto-Enter a calc:

             

            For the Imperial field:

             

            Case(
            Get ( ActiveFieldName ) = "Metric" ; Metric/2.54 ;
            Self
            )

             

            For the Metric field:

             

            Case(
            Get ( ActiveFieldName ) = "Imperial" ; Imperial*2.54 ;
            Self
            )



            • 3. Re: Field Calculation problem~
              Ray

              Dear Daniele

               

              May I ask what is the meaning "ActiveFieldName" in

              Case(Get ( ActiveFieldName ) = "Metric" ; Metric/2.54 ;Self)  ?

               

              Besides, if I choosing the field type in "calculation", I still can not type the number in this field. Are there something I misunderstanding? 

               

              Thanks,

               

              Ray

              • 4. Re: Field Calculation problem~
                raybaudi

                raybaudi wrote:

                 

                Simply add these calculations into their option of Auto-Enter


                 

                You do not have to tranform the number field into a calculated field, but ONLY to modify its options.

                 


                • 5. Re: Field Calculation problem~
                  Ray

                   

                  I see, it works really well ^^

                   

                  thanks,

                   

                  Ray