Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Par2: Re-using routines 1999-04-20 -- Dan Presnell > In cw5ee is there any way to create a create a global routine?
> Basically I need to use the exact same piece of code in several places,
> but it needs to manipulate many pieces of data local to each of the
> procedures.
There is a way, if the variables, fields, and controls the routine
manipultes or refers to are all named the same in each procedure.
1. In the one procedure where you have written your routine, surround
it with a SECTION statement, like this:
SECTION('MYROUTINE', '***')
myroutine routine
! some code here
***
2. Note the module that procedure is in (such as MYPRG001.CLW), and
uncheck the "Allow repopulate" option for the module so it doesn't get
renamed.
3. Now in all the other procedures where you need the routine, in the
Procedure Routines embed, put this:
include('myprg007.clw', 'MYROUTINE')
This method can come in handy if, for example, the routine refers to a
very large number of controls on a report or window and you don't want
to write a procedure passing each as a parameter.
Today is November 21, 2024, 7:50 am This article has been viewed 35295 times.
|
|