3 Replies Latest reply on Oct 11, 2007 6:23 AM by Mike Crisp

    Using BAltered to check data in fields

    Mike Crisp Level 1
      I have 3 fields which are to be completed when a user selects an option (simple mouseUp command) I want to check the fields already have text in them.

      If FIELD 1 has data the new selection should go into field 2,
      If FIELDS 1 and 2 have data the new selection should go into field 3,

      using the script below I have been able to check if FIELD 1 is used and if so add to FIELD 2 however I need the script to stop when it has identified that it has now used field 2 and doesn't need to put it in the 3rd field as well.

      I hope that makes sense

      On mouseUp
      bAltered = 0

      if member("Activity1_mini").text <> EMPTY then bAltered = 1
      if member("Activity2_mini").text <> EMPTY then bAltered = 1
      if member("Activity3_mini").text <> EMPTY then bAltered = 1

      if bAltered = 0 then -- add to first box

      member("Activity1_mini").text = "There & Back"

      end if

      if bAltered = 1 then -- add to next available box

      member("Activity2_mini").text = "There & Back"

      if bAltered = 1 then

      member("Activity3_mini").text = "There & Back"

      end if

      end if

      end
        • 1. Re: Using BAltered to check data in fields
          Level 7
          I am not real sure what you are doing, but something like this may work:

          On mouseUp
          bAltered = 0

          if member("Activity1_mini").text <> EMPTY then bAltered = 1
          if member("Activity2_mini").text <> EMPTY then bAltered = 2
          if member("Activity3_mini").text <> EMPTY then bAltered = 3

          case bAltered of
          0: -- add to first box
          member("Activity1_mini").text = "There & Back"
          1: -- add to next available box
          member("Activity2_mini").text = "There & Back"
          2: -- addto the last box
          member("Activity3_mini").text = "There & Back"
          end case

          end
          • 2. Re: Using BAltered to check data in fields
            Level 7
            On mouseUp
            bAltered = 0

            if member("Activity1_mini").text = EMPTY then bAltered = bAltered + 2
            if member("Activity2_mini").text = EMPTY then bAltered = bAltered + 4
            if member("Activity3_mini").text = EMPTY then bAltered = bAltered + 8

            case bAltered of
            0: -- all full,
            -- nothing
            2: -- box 1 empty
            member("Activity1_mini").text = "There & Back"
            4: -- box 2 empty
            member("Activity2_mini").text = "There & Back"
            6: -- box 1 2 empty
            member("Activity1_mini").text = "There & Back"
            member("Activity2_mini").text = "There & Back"
            8: -- box 3 empty
            member("Activity3_mini").text = "There & Back"
            10: -- box 1 3 empty
            member("Activity1_mini").text = "There & Back"
            member("Activity3_mini").text = "There & Back"
            12: -- box 2 3 empty
            member("Activity2_mini").text = "There & Back"
            member("Activity3_mini").text = "There & Back"
            14: -- box 1 2 3 empty
            member("Activity1_mini").text = "There & Back"
            member("Activity2_mini").text = "There & Back"
            member("Activity3_mini").text = "There & Back"
            end case
            end

            else

            On mouseUp
            bAltered = [0,0,0]

            if member("Activity1_mini").text = EMPTY then bAltered[1] = 1
            if member("Activity2_mini").text = EMPTY then bAltered[2] = 1
            if member("Activity3_mini").text = EMPTY then bAltered[3] = 1

            repeat with i = 1 to bAltered.count
            if bAltered = 1 then
            member("Activity" & i & "_mini").text = "There & Back"
            end if
            end repeat

            end
            • 3. Using BAltered to check data in fields
              Mike Crisp Level 1
              Mike

              Considering you didn't have a clue what I was on about - your answer was perfect !! Please have a look at the link below and perhaps you may be able to help me with a couple of other things.

              Code Link

              1. There are 80 of the practices (as shown on the screen) when all the boxes are full I want the last box to change to what ever the user selects (until they have the activities they want)

              2. I want to stop the user from selecting and adding the same activity twice and perhaps use an alert "You have already selected this practice"

              Any suggestions.

              Many thanks Mike