Using DI 11.5… how can I introduce/use global variables within a function?
I have a function using FTP commands that create an output file (using ftp) but I am trying to name the file according to a global variable…
Any suggestions or can you confirm what the rules are?
spiceman (BOB member since 2007-12-04)
Using DI 11.5… how can I introduce/use global variables within a function?
I have a function using FTP commands that create an output file (using ftp) but I am trying to name the file according to a global variable…
Any suggestions or can you confirm what the rules are?
You may want to have an input parameter defined in the function; and pass the global variable value to the function everytime you invoke the function.
srinivas_t (BOB member since 2007-11-25)
but… are you confirming that i can not call a global variable from within a function?
spiceman (BOB member since 2007-12-04)
We can use global variables in custom functions.
What I said was the suggested way of doing it!
srinivas_t (BOB member since 2007-11-25)
system
May 19, 2009, 11:02am
5
Hmm… ok… instead of passing the global variable into the function, can i simply refer to it from within the Function…
Whenever i just write the global variable within the function it gives me an error indicating that it is not allowed
spiceman (BOB member since 2007-12-04)
system
May 19, 2009, 12:44pm
6
Still, it’s poor coding practice IMO. With functions you have the explicit capability to pass in all of the parameters you need. It’s better to formally declare them as input parameters and pass them in.
dnewton (BOB member since 2004-01-30)