KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: What are processes and why would you use them?
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: May 23, 2002

Compatibility: version 6.5.x, 6.7.x and 6.8.x

Summary:

This tech tip provides a functional description of what processes are, with the goal of giving you a working understanding of processes in 4th Dimension.

A powerful feature of 4th Dimension is the ability to create multiple processes. But, what are processes and why would you use them? Often times things are best understood by comparison with the familiar. So, for a moment, let's consider some software applications other than 4D.


When you launch Microsoft Word, your computer reads the code for Word, and uses that code to create an environment in which you can work. This environment has certain characteristic elements. It has a menu bar with menus and items. It has a window. Within that window it displays a metaphor for a sheet of paper. Within that window, there is also a cursor. That cursor has the behavior of moving to the right as you type. And, as you type, letters appear on the "page". These are the elements of the Microsoft Word environment.


When you launch Microsoft Excel, your computer reads the code for Excel, and uses that code to create another environment in which you can work. This environment has its own characteristic elements. It has a menu bar with menus and items. It has a window. Within that window it displays a metaphor for a sheet with rows and columns forming cells. Within that window, there is also a cursor. Additionally, there is code that you may be running if you have entered formulas in cells. These are the elements of the Microsoft Word environment.


Now let's consider 4D (in the User environment). 4D also creates an environment, and this environment has it's own characteristic elements. It has a menu bar with menus and items. It has a window. Within that window, a default List Form is used to display a Current Selection of records for the Default Table. If you double click on a record in the list, the default Detail Form is used to display the Current Record. Additionally, this environment may have a method that is executing. And, a form or method may have variables. Finally, this environment has a space in memory, or stack, that it uses. These are the elements of the 4D environment.


By default, 4D provides you with a single environment in which to work. But, there may be times when you will want to have 4D support more than one task at the same time. This is made possible by replicating the 4D environment. Each of these instances of the 4D environment is referred to as a process, and each process has its own instances of the elements that comprise the 4D environment. So each process can have its own:



  • Menu bar with menus and items.
  • Window
  • Default Table
  • Default List Form per table
  • Current Selection of records per table.
  • Default Detail Form per table
  • Current Record per table
  • Method that is executing.
  • Variables on forms or in methods.
  • Stack (memory space)

So, a process is an instance of the 4D environment.


And when would you use 4D's multi-process capability? Well, you will use this feature of 4D any time that you want 4D to perform multiple tasks concurrently; in other words, any time you want to do multi-tasking.


For example, suppose you want to do a query, review the resulting list of records, then click on a button to export those records, and then continue to work with the records you were viewing. If your export button does not create a new process, the window displayed by the current process will not be free to be used to work with the records until the export is done. But if your export button creates a new process, then that process can do the export, making the window of the original process immediately available for working with the records.


Or suppose you want to compare the detail of different records. If you display a detail view of one record and then display a detail of another record in the same process, the detail view of the first record will replace the view of the 2nd record, making comparison of the records impossible. But if you create separate processes for viewing the different records, then each record will be displayed in its own window, making it possible to compare the records.


These are two examples of the use of processes that illustrate what processes are, and how processes support multi-tasking in 4th Dimension.