5 Replies Latest reply on Mar 17, 2011 4:44 PM by schnook

    mulitple if statement?

    schnook

      Title

      mulitple if statement?

      Post

      Hello all,

      Fields: Frequency, From, To and Remarks 

      OK we have a drop down box in our Frequency field that contains stuff like Open Station, Weather, Close Station, 107.5 FM etc. It would be nice that if any of these values were selected it would automatically enter information into the From, To and Remarks field

      For example 3 below

      if the Frequency Field = Open Station, it would then enter in the From field VMR466, the To field All Ships and in the Remarks field Open station

      if the Frequency field = 107.5 FM, it would then enter in the From field VMR466, the To 107.5 FM and the Remarks field LOB's

      if the Frequency field = TOLW, it would enter in the From field VMR466, in the To field VTS Gladstone, and in the Remarks field TOLW

      Could someone help with this script please.

      We are using FMP 11 pro advanced on a win xp pc with service pk 3

      Regards

      schnook

        • 1. Re: mulitple if statement?
          philmodjunk

          Why use a script. You can set up auto-enter calculations for this.

          The From field seems to always get "VMR466", you can simply set up the From field to auto enter that text. The field can be edited after the fact to enter or select different text in cases where this is not the desired value.

          The To field can use an auto-enter calculation with the case function:

          Case ( FrequencyField = "Open Station" ; "All Ships" ;
                    FrequencyField = "107.5 FM" ; FrequencyField ;
                    FrequncyField = "TOLW" ; "VTS Gladstone "
                   )

          Remarks can be set up the same way.

          A much more flexible approach would be to set up a table where you have one record for each value in the frequency field where you want such data to appear automatically. Add fields as needed for From, To, and Remarks. You can then relate your main table to this table by their "frequency" fields and either use Looked up value field options to copy the data into matching fields, (a "static" link) or you can just place the fields from this related table (a "dynamic" link).

          To better choose between dynamic and static links to data in a related table, see this thread:  Auto Fill

          • 2. Re: mulitple if statement?
            schnook

            Hey Phil

            The FROM field dose not always have VMR466 in it only for certain entries, will this still work if set to auto-enter calculation for different entries, where FROM may contain a vessel registration number.

            Regards

            schnook

            • 3. Re: mulitple if statement?
              philmodjunk

              Any auto-entered data may still be edited by the user. The one auto-enter feature that can prevent that is when you clear the "do not replace existing value..." option for an auto-entered calculation. Then you can edit the values, but the calculation will kick in and modify the data after you exit--potentially  changing the value back again.

              If VMR466 is the value entered most of the time, you can enter it in the data box on the auto enter tab and you'll see this as the default value in any new record, but you can always change the value in cases where you need a different value. It's your call as to whether this is a good interface design option for your particular solution.

              • 4. Re: mulitple if statement?
                philmodjunk

                Please keep in mind that auto-entered calculations and/or auto entered data may well NOT be the best option for you. If you set up a look up table like I suggested at the end of my first post, you can adjust what data appears when circumstances change just by editing the data in the look up table instead of having to redefine your auto-enter calculations--something that's a much more user friendly operation.

                • 5. Re: mulitple if statement?
                  schnook

                  Hey Phil,

                  I think i will set up a look up table like you have suggested, thanks for your time once again.

                  Regards

                  schnook