Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - <b>name:</b> <b>execute() - execute a function <nn> times</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Name:     execute() - execute a function <nn> times
            _xval()  - get current execute() loop number

  Usage:    <logical> = execute(<num>,<function>)
            <integer> = _xval()
  Params:   integer <num> - number of times to execute function
            string <function> - function name enclosed in quotes
  Returns:  .T. if all loops terminated, .F. if loops terminated
            before <num> loops have been executed.
            _xval() returns an integer equal to the current or
            last loop number executed.

 ---------------------------------- Example ---------------------------------

                 execute(10,"Delfunc()")
                 ? "total records deleted:"
                 ?? _xval()
                 quit

                 function Delfunc

                 seek empname
                 if found()
                      delete
                      return(.T.)
                 else
                      return(.F.)
                 endif

  Note:     To terminate looping, return .F. in your function.
            If a function returns .T., execute() keeps looping
            until <nn> loops have been executed. The function
            _xval() can be used inside the function that is
            looping to find out the current loop number. after
            you run execute(), _xval() will contain the total
            number of loops that were completed by execute(). The
            execute() function can be called recursively.

            You can pass parameters to the function by including them
            in the function call just as you would call them normally.
            For example, if you wanted to pass the value of a memvar to
            the function, you would specify the function parameter
            as follows:

                 execute(10,"delfunc(memvar)")

            If you want to pass a constant, that constant has to be
            enclosed in quotes even inside the quotes that define the
            function as a string. This can be done by enclosing the
            constant in single quotes or brackets. As an example, if
            you want to pass the string "test" to delfunc(), you would
            code it as follows:

                 execute(10,"delfunc('test')")

            You can also pass complex function expressions to execute().
            Just code the function exactly as you would code it in your
            program. Make sure that any constant strings are enclosed
            in single quotes, and the entire function expression is
            enclosed in double quotes. You could pass the following
            function declaration to execute():

                 select A
                 use employee index empname ALIAS EMPLOYEE
                 select B
                 use position index empname ALIAS POSITION
                 set relation to empno into A

            execute(10,"delfunc(upper(trim(EMPLOYEE->fname)))")

            You must always remember to include the parenthesis
            in the function name. Unlike achoice(), execute()
            requires that parenthesis be part of the name
            enclosed in quotes. The execute() function always
            executes a minimum of one time, even if you specify
            0 as the number of loops.


See Also: ondo()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson