Hi all,
Ok, I know this isn't STRICTLY a NetTalk programming issue, and is something probably out of 'Programming for Beginners' that I have forgotten about - but I have a question about variable scoping in a threaded app such as NetTalk.
Of, here is the situation: Say I have a NetWebPage or something, that is responsible for manipulating data from several files (e.g. MyFile1 and MyFile2 that contain fields such as F1:FirstField, F1:SecondField, F2:AnotherField etc.)
Ok, my NetWebPage may do something like this:
Do OpenFiles
F1:ID = 100
Access:MyFile1.Fetch(F1:PRIMARY)
F2:ID = F1:LinkedID
Access:MyFile2.Fetch(F2:PRIMARY)
... other stuff ...
ReturnString = DoSomeFunction(F1:Action)
packet = packet & ReturnString
Do SendPacket
Do CloseFiles
Ok, the issue here is when I call the DoSomeFunction() function. This function will basically look at the F1:Action parameter, and do some string building based on the action requested.
The thing is, DoSomeFunction() needs to do some manipulation of the contents of fields in MyFile1 and MyFile2, an example snippet within this function might be:
Case PassedAction
Of 1
RetVal = 'Hello ' & F1:FirstName & ' ' & F1:LastName & ' how are you?'
Of 2
RetVal = 'There are ' & Records(MyFile1) & ' records to process'
Of 3
RetVal = F1:FirstName & ', you are responsible for ' & F2:StudentName & ' until ' & Format(F2:EndDate, @D17)
End
Return(RetVal)
Basically, my question is: Can DoSomeFunction() SEE the variable contents that are passed from the calling threaded procedure? Bear in mind, this function can be called from several different procedures - even the SAME procedure on different threads if there are a lot of users on the site.
If it CAN see the contents of the globally declared files, how safe is this method?
Is there a better way to do this, considering that the function will have to work with the contents of about 20 different files to generate the returned string?
Thanks,
Devan