KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Just DoIt (with EXECUTE)
PRODUCT: 4D | VERSION: | PLATFORM:
Published On: November 24, 1999

Have you ever wished for a 4D "Command Line"? You may not realize it, but you can get to the 4D "Command Line" with the EXECUTE command. This command, which the documentation says "You will rarely need to use this" takes one Text string as a Statement. This statement then gets executed as if it were a line of 4D Code.

The documentation says you will rarely need to use this command - and indeed, in "production" code, you should avoid using it whenever possible. However, this command is very useful when used in a wrapper method such as "DoIt."

"DoIt" is a method you will find in many 4D applications. Sometimes it will be called ".DoIt" or "aDoIt" or "_DoIt" (to change where it appears in the method list) or some other name entirely.

You can then execute this method from the User Environment - choose "Execute Method" from the "Special" menu and execute .DoIt. You will be prompted for a text string. Examples of things you might do are:

Cut and Paste the following code example into your
own 4D project

 '`Project Method: DoIt
 `Purpose: Executes a line of 4D Code
 `Inputs:
 `$1: Text (Optional) - What to Do
 `Outputs: None
 `Modification History:

C_TEXT($1;$tWhat)

If (Count parameters>0)
 $tWhat:=$1
Else
 $tWhat:=""End if

If ($tWhat="")
$tWhat:=Request("Do what?")
Else
 OK:=1
End if

If (OK=1) & ($tWhat#"")
EXECUTE($tWhat)
End if

---

TRACE `bring up the TRACE window
<>DEBUG:=True `put your system into "debug" mode
OD OPEN DEBUG WINDOW `bring up the 4D for Oracle Debug Window
SET HOME PAGE `change the Home Page for the built-in web server