Getting or Pushing Value from one function to Another

Hello All,

I need a small help, I have two functions in a Agent function,

step 1-

Function one runs to get some values from a server in different geographic location so it takes long time to retrive the values and the retrived value should be sent to a set of users automatically.

step 2-

I have to send the same retrived value(from function one) to another set of users with some additions in that mail. In order to achive this I have the function two.Function two is another copy of Function one with some added contents.

The problem here is its taking too long time to send those mails. I mean the same Function is running twice so.

In order to reduce the time is there any option of sending(passing) the values which I got(retrived) in Function one to Function two.

Please Advise

Thanks in advance

Madhan

Subject: Getting Value from one function to Another

Of course you can use the values from function 1 and pass them on to function 2.

You have several options.

You could declare some global variables that are being updated by function 1, then function 2 could just use those values.

Example:

(Declarations)

Dim strGlobalData As String

Sub Initialize

res = function1()

res = function2()

End Sub

Function Function1() As Integer

… code …

strGlobalData = “Data to keep”

End Function

Function Function2() As Integer

… code …

Use the strGlobalData variable as you please.

End Function

Another way is to declare the areas to be updated locally, and then pass them on to function 2:

Example:

Sub Initialize

Dim strLocalData As String

res = function1(strLocalData)

res = function2(strLocalData)

End Sub

Function Function1(pLocalData As String) As Integer

… code …

pLocalData = “Data to keep”

End Function

Function Function2(pLocalData As String) As Integer

… code …

Use the pLocalData variable as you please.

End Function

Was this what you wanted to know?

ken@noteshound.com

Subject: RE: Getting Value from one function to Another

Thank you Kenneth. It helped me.