Thread Safe Question
I'm using D7 and RB 7.04. I'm using reports on forms or datamodules. All
of my reports prompt for autosearch parameters. The majority of the reports
require a store number and a starting and ending date. After the autosearch
criteria is entered, I apply the parameters to the appropriate queries
and/or stored procedures. I've been using global variables (within the
form's implementation section) to store the store number and starting and
ending dates. Obviously, this is not thread safe. I'm using a critical
section when I assign the values to those variables, but there are functions
attached to the report event handlers that need to access these values.
What would you recommend to make certain that these variables become thread
safe?
of my reports prompt for autosearch parameters. The majority of the reports
require a store number and a starting and ending date. After the autosearch
criteria is entered, I apply the parameters to the appropriate queries
and/or stored procedures. I've been using global variables (within the
form's implementation section) to store the store number and starting and
ending dates. Obviously, this is not thread safe. I'm using a critical
section when I assign the values to those variables, but there are functions
attached to the report event handlers that need to access these values.
What would you recommend to make certain that these variables become thread
safe?
This discussion has been closed.
Comments
You are correct - for a server solution you want to remove all the globals
Probably the simplest modification at this point is to convert them to
Form/DataModule fields or properties. Your event-handler code would probably
work unchanged.
I am not quite clear why you need additional variables. Why not just use the
Report.AutoSearchFields[] as the place holders. Access them from your
event-handlers?
Another option is to define Define Report.Parameters[ ]
When you have time, check out RB 11. RB 11 has enhanced support for
parameters/autosearch. You can use the Designer to add and configure
parameters that can have autosearch and lookup settings. You can bind
query's to the parameters. Very simple and powerful.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com