In my posts on virtualization I forgot to mention something. While I did say I was running with the multi-thread option instead of the replay in order option, I left the number of threads at the default of 4. I ran it with 64 threads earlier, but with the replay in order option. Those replays took well over 5 hours, as opposed to 2 1/2 – 3 hours with multi-thread at 4. But if I compare multi-threading at 4 with multi-threading at 64, then the times are much better – 3 1/2 hours compared to 2 3/4 hours on the same virtual server. I’ll summarize all my tests in a few weeks when I’ve completed all my tests.
The second post I need to update regards repeating data in a page header using SSRS. I solution was to use a shared variable. This had potential problems which I neglected to mention. If you use a shared variable then anyone running the report at the same time could overwrite each other values. I knew this at the time I put the report into production, but I thought the odds of that happening would be slim. Later I found I could produce that exact behavior in testing; when I ran the report simultaneously with another tester we did indeed cross values.
I changed the report to use a hashtable instead. The value in each record would be unique since it will depend on the user id of whoever is running the report. As an example of repeating a customer name on each page I
- Added a hidden row to the top of the table control on the report. The table was already there and the grouping was already set on the customer name.
- Added the customer name field from the table’s dataset to the hidden row.
- In the report code section I added a shared hashtable – DIM htCustomer AS system.collections.hashtable = NEW system.collections.hashtable. The hashtable still needs to be shared.
- Still in the code section, I added a new function to add a record to the hastable if it didn’t exist or update it if it did. The function takes three parameters; the value from the hidden field, a group name, and the user id. It returns the customer name for the current user
DIM key AS STRING = groupName & UserID
IF NOT group IS NOTHING
DIM g AS STRING= CTYPE(group, STRING)
IF NOT (htCustomer.ContainsKey(key) THEN
htCustomer.Add(key, g)
ELSE
IF NOT (htCustomer(key).Equals(g)) THEN
htCustomer(key) = g)
END IF
END IF
END IF
RETURN htCustomer(key)
5. Add a page header to the report. Add a new text box that uses an expression to call the function and pass in the parameters
=Code.SetCustomerName(ReportItems!txtCustomer.Value, “Customer”, User!UserID)
ReportItems!txtCustomer is the hidden field; Customer is my group name, and User!ID is a global parameter available to the report.
No comments:
Post a Comment