I develop a QV report which has a macro doing calculation and upload the results to tables by using Dynamicupdate INSERT command.
A chart is referring to this tables and reflects the uploaded results on the fly.
This QV report works fine on PC stand alone as well as on a server.
Users can access the report, run macro and upload data from an Ajax client with no problem.
However, we recently found out that the table data and chart will be corrupted if more than one user have session.
We are guessing that the table residing in the server memory is shared among users if there are multiple clients having sessions and running macros at the same time.
How to resolve this kind of issue?
Actually, I've tried to add an user ID field to the table so that the records inserted associated with the users, and I set analysis to get the data set based on the user ID.
In loading script, a variable keeps user ID
and add a field UID to table
LOAD * Inline [
UID, ttfwk_fit, fir_fit, dr_fit
In macro, the user ID variable vUser is passed to macro as
set v =ActiveDocument.Variables("vUser")
In macro, the insert command is used to upload results where ttf(i), accufir(i) and fir(i) are calculation results done by VB code in the macro
insertString = "INSERT INTO data_tbl (UID,ttfwk_fit,fir_fit,dr_fit) VALUES (" & userID & "," & ttf(i) & "," & accufir(i) & "," & fir(i) & ")"
set result = ActiveDocument.DynamicUpdateCommand(insertString)
The expression used in the chart. The set analysis sets the only UID = vUser data:
This solution doesn't work for multiple users.
We realized that the vUser will tied to the user who launches the qvw on serve at the first time.
How can I get the User ID dynamically?