6 Replies Latest reply on Feb 19, 2014 1:10 PM by KristinLandau_1

    Case or If or some other function, maybe?

    KristinLandau_1

      Title

      Case or If or some other function, maybe?

      Post

           Hello, I'm a new FM user and trying to build a database for archaeology.

           We dig pits that have four corners, southwest, northwest, southeast, northeast.

           Every so often we measure the depth of each pit (e.g., in the southwest corner we started at 386.60 meters above sea level and dug 40 cm below (=386.20 m), in the northwest corner we are 38 cm below, etc.).

           We take this measurement using ONLY ONE CORNER (the "reference corner") but it varies by pit (so in Pit 1, we used the southwest corner, but in Pit 2 we used the southeast corner). Thus to know the depth of each corner, we subtract our measurement, say 35 cm, from the "reference corner". 

           I created an option that lets the user select, via radio button, which corner was used for measuring. Great.

           Now, I would like automate the subtraction process. When the southwest radio button is clicked, I want to subtract the specific depths from all the corners, only from the southwest corner value. When the southeast radio button is clicked, I want to subtract the specific depths from all the corners, only from the southeast corner value, etc.

           Here's a screen shot of the portal:

           It's in Spanish:

           SO=southwest

           SE=southeast

           NO=northwest

           NE=northeast

           "cm below reference corner"

           "final elevation of level"

            

           Ideas..help.. ?? Thanks!

           Also, these are what the numbers SHOULD be, but I had to do it myself on a calculator. I'll have about 600 records, so I'd rather not have to do it all manually...

      Screenshot_2014-02-19_12.08.40.png

        • 1. Re: Case or If or some other function, maybe?
          philmodjunk

               Case ( YourRadioButtonFieldHere = "SO" ; SouthWestDepth;
                          YourRadioButtonFieldHere = "SE" ; SouthEastDepth;
                          YourRadioButtonFieldHere = "NO" ; NorthWestDepth;
                           YourRadioButtonFieldHere = "NE" ;NorthEastDepth
                         ) - CornerDepthField goes here

               You'd need one such calculation field for each corner so you'd put a reference to a different corner in place of "CornerDepthField goes here" in each version of this same calculation.

          • 2. Re: Case or If or some other function, maybe?
            KristinLandau_1

                 Thanks for your response! I think I have followed so far. Can you explain again the CornerDepthField? This would be the number of centimeters dug down, on each corner?

                 Also, what would the next step be, to get the final elevation? What do I write to calculate the "final elevation", which is the original elevation of the one radio button-selected corner, minus the number of centimeters dug?

            • 3. Re: Case or If or some other function, maybe?
              philmodjunk
                   

                        This would be the number of centimeters dug down, on each corner?

                   Yes and this will be a different field in each copy of this calculation. I don't know Spanish so I used my own names in hopes that you could figure out which actual fields to use in place of mine.

                   

                        Also, what would the next step be, to get the final elevation? What do I write to calculate the "final elevation", which is the original elevation of the one radio button-selected corner, minus the number of centimeters dug?

                   Minus the centimeters dug in which corner?

              • 4. Re: Case or If or some other function, maybe?
                KristinLandau_1

                     Okay, one more question:

                     Right now I have the radio buttons as a single field. They are pulling values from a list of custom values I made real quick: SO, SE, NO, NE.

                     Here is what I have in the calculation, where "EsquinaUsada" is the radio button, and "SO1" is the original, and "SO4" is the final elevation. I have one of these for each corner.

                      

                     Case ( EsquinaUsada = "SO" ; "SO1" ;
                                EsquinaUsada = "SE" ; "SE1";
                                EsquinaUsada = "NO" ; "NO1";
                                EsquinaUsada = "NE" ; "NE1"
                               )  - SO4
                      
                     What is going wrong?! The values don't change when I switch between the radio buttons, either. Does the "EsquinaUsada" field need to be a table, with SO, SE, NO, and NE each as a field, somehow related to something else?
                      
                • 5. Re: Case or If or some other function, maybe?
                  philmodjunk
                       Case ( EsquinaUsada = "SO" ; "SO1" ;
                                  EsquinaUsada = "SE" ; "SE1";
                                  EsquinaUsada = "NO" ; "NO1";
                                  EsquinaUsada = "NE" ; "NE1"
                                 )  - SO4
                       The text in red should not be there in quotes. You need the reference to the actual fields that record the needed data for that corner of your plot.
                  • 6. Re: Case or If or some other function, maybe?
                    KristinLandau_1

                         It works!!!! THANK YOU.