7 Replies Latest reply on Aug 20, 2015 10:03 AM by Extensitech

    Enter Find Mode: prevents some script steps ?

    planteg

      Hi,

       

      this is part of a script that gives me headaches:

      Set Gobal.jpg

      I set the contents of this Global Variable to display it on the report.

       

      What bugs me is whatever it's the if or else that is executed, my global variable is empty. I used the Script Debugger (FMPA 13), and the variable is not shown as if the step is not executed. Is it possible that after Enter Find Mode [], you can only set fields contents for the Find ?

       

      Thanks

       

      Gilles Plante

        • 1. Re: Enter Find Mode: prevents some script steps ?
          Extensitech

          When in find mode, all fields are blank, including global fields. So, for  example, in step four you appear to be setting PayEntry::CodeEmployee to blank, and I'm not sure what you're setting your global variable to in step 7.


          If you are thinking of global fields as variables, this may seem counter-intuitive, but while the role of global fields overlaps with that of variables, they aren't the same thing.

           

          Setting the global variable in step 5 to a text string should definitely work in whatever mode you're in, though, including find mode. See screenshot: screenshot.png

           

          Chris Cain

          Extensitech

          • 2. Re: Enter Find Mode: prevents some script steps ?
            planteg

            Chris,

             

            what I want to do is set the global variable to either the name of an employee, or All (Tous) when z_Resources::z_CodeEmploye begins in "0". Now what puzzle me is that it looks like for you it works. Hum. I will try again and come back.

             

            Edit #1


            I realized that the two steps setting the Global variable were mixed up. Now when I ask for all of the employees, I get "Tous" as I expect.

             

            When in find mode, all fields are blank, including global fields.


            But in the other case, the Global variable would be set to "" because PayEntry__EMPLOYES::Nom Complet is empty now. That being said, I don't get an empty Global variable, that variable is gone ?!?

             

            Gilles Plante

            • 3. Re: Enter Find Mode: prevents some script steps ?
              Extensitech

              As a general rule, I'd recommend you capture any field values you need (including global field values) into variables before going into find mode. They can be local variables. This gives a clear demarcation where you're going from browse to find, and also offers a nice opportunity for clear documentation of what you're up to. As a habit, it may feel a bit verbose at first, but it makes debugging and troubleshooting so much easier that I feel it's well worth it.

               

              Chris Cain

              Extensitech

              • 4. Re: Enter Find Mode: prevents some script steps ?
                planteg

                This is exactly what I have done:

                • I set the Global variable
                • and set a local variable if only for one employee

                Then I set the fields for the Find.

                 

                Now it works fine.

                 

                Thanks for pointing me in the right direction.

                 

                Gilles Plante

                • 5. Re: Enter Find Mode: prevents some script steps ?
                  DavidJondreau

                  I agree with Chris' general points. Set your variables before you go into find. Keep in mind though that global fields do maintain their values in Find mode and before $variables came into being where often used to transfer values to a find.

                   

                  My guess is that PayEntry  EMPLOYES::NonComplete is not a global field and trying to grab it in Find mode returns nothing. Or there's something else wrong with that script step (the field name pattern doesn't match your other field name patterns).

                  • 6. Re: Enter Find Mode: prevents some script steps ?
                    planteg

                    My guess is that PayEntry  EMPLOYES::NonComplete is not a global field and trying to grab it in Find mode returns nothing.


                    Your guess is correct .


                    Gilles Plante

                    • 7. Re: Enter Find Mode: prevents some script steps ?
                      Extensitech

                      Extensitech wrote:

                       

                      When in find mode, all fields are blank, including global fields.

                      Based on DavidJondreau's post, I took another look and realized I was wrong about this, btw. Interesting.

                       

                      Chris Cain

                      Extensitech