I am experiencing an issue of the code-behind variables being cached in
between report renders. This was noticed during a stress test. When
two users generated the same report for a different customer, the first
report was fine, the second report contained the header for the first
report but the correct data in the body for the second report.
The header is created using values from the code-behind page. The body
calls a function and stores certain values to be used in the header.
This is the expression in the body that makes the call:
=Code.SetHeaderInfo(First(Fields!NAME.Value, "HEADER"),
First(Fields!CUSTOMERREFERENCE.Value, "HEADER"),
First(Fields!POLICYEFFECTIVEDATE.Value, "HEADER"),
First(Fields!POLICYEXPIRATIONDATE.Value, "HEADER"),
First(Fields!HISTORICALCLAIMNUMBER.Value, "HEADER"),
First(Fields!ISPCACONVERTED.Value, "HEADER"))
This is the code:
Public Shared strInsuredName As String = Nothing
Public Shared strContractNum As String = Nothing
Public Shared strPolicyEffDate As Date = Nothing
Public Shared strPolicyExpDate As Date = Nothing
Public Shared strHistClaimNum as String = Nothing
Public Shared intISPCAConverted as Integer = Nothing
Public Shared Function SetHeaderInfo(ByVal strInsuredNameTemp As
String, ByVal strContractNumTemp As String, _
ByVal strPolicyEffDateTemp As String, ByVal strPolicyExpDateTemp As
String, ByVal strHistClaimNumTemp As String, _
ByVal intISPCAConvertedTemp as Integer) As String
strInsuredName = Nothing
strContractNum = Nothing
strPolicyEffDate = Nothing
strPolicyExpDate = Nothing
strHistClaimNum = Nothing
intISPCAConverted = Nothing
strInsuredName = strInsuredNameTemp
strContractNum = Mid(strContractNumTemp, 1, 3) & "-" &
Mid(strContractNumTemp, 4, 4) & "-" & Mid(strContractNumTemp, 8, 1)
strPolicyEffDate = strPolicyEffDateTemp
strPolicyExpDate = strPolicyExpDateTemp
strHistClaimNum = strHistClaimNumTemp
intISPCAConverted = intISPCAConvertedTemp
End Function
And an example of an expression in the header:
="Insured: " & iif(Code.strInsuredName = "", "ERROR",
Code.strInsuredName)
I can post the .rdl if anyone thinks it will help. A little more
background, we're using an ASP.NET app and RS's web service to render
the reports. I have been able to duplicate this problem myself, by
opening up two separate IE windows and launching the same report for 2
customers at the same time. This has happened in a load-balanced and
non load-balanced environment.
Thanks for any input.
Kel KoenigStatic (shared) fields defined in report.Code or in custom assemblies are
'shared' between report executions.
This is a known issue.
Do not store report execution values in static fields or if you do then make
a dictionary that will keep the state per some key that is unique for the
current report instance - for example report execution time (Globals)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
<kelkoenig@.gmail.com> wrote in message
news:1124892077.666011.325010@.z14g2000cwz.googlegroups.com...
>I am experiencing an issue of the code-behind variables being cached in
> between report renders. This was noticed during a stress test. When
> two users generated the same report for a different customer, the first
> report was fine, the second report contained the header for the first
> report but the correct data in the body for the second report.
> The header is created using values from the code-behind page. The body
> calls a function and stores certain values to be used in the header.
> This is the expression in the body that makes the call:
> =Code.SetHeaderInfo(First(Fields!NAME.Value, "HEADER"),
> First(Fields!CUSTOMERREFERENCE.Value, "HEADER"),
> First(Fields!POLICYEFFECTIVEDATE.Value, "HEADER"),
> First(Fields!POLICYEXPIRATIONDATE.Value, "HEADER"),
> First(Fields!HISTORICALCLAIMNUMBER.Value, "HEADER"),
> First(Fields!ISPCACONVERTED.Value, "HEADER"))
> This is the code:
> Public Shared strInsuredName As String = Nothing
> Public Shared strContractNum As String = Nothing
> Public Shared strPolicyEffDate As Date = Nothing
> Public Shared strPolicyExpDate As Date = Nothing
> Public Shared strHistClaimNum as String = Nothing
> Public Shared intISPCAConverted as Integer = Nothing
> Public Shared Function SetHeaderInfo(ByVal strInsuredNameTemp As
> String, ByVal strContractNumTemp As String, _
> ByVal strPolicyEffDateTemp As String, ByVal strPolicyExpDateTemp As
> String, ByVal strHistClaimNumTemp As String, _
> ByVal intISPCAConvertedTemp as Integer) As String
> strInsuredName = Nothing
> strContractNum = Nothing
> strPolicyEffDate = Nothing
> strPolicyExpDate = Nothing
> strHistClaimNum = Nothing
> intISPCAConverted = Nothing
> strInsuredName = strInsuredNameTemp
> strContractNum = Mid(strContractNumTemp, 1, 3) & "-" &
> Mid(strContractNumTemp, 4, 4) & "-" & Mid(strContractNumTemp, 8, 1)
> strPolicyEffDate = strPolicyEffDateTemp
> strPolicyExpDate = strPolicyExpDateTemp
> strHistClaimNum = strHistClaimNumTemp
> intISPCAConverted = intISPCAConvertedTemp
> End Function
>
> And an example of an expression in the header:
> ="Insured: " & iif(Code.strInsuredName = "", "ERROR",
> Code.strInsuredName)
> I can post the .rdl if anyone thinks it will help. A little more
> background, we're using an ASP.NET app and RS's web service to render
> the reports. I have been able to duplicate this problem myself, by
> opening up two separate IE windows and launching the same report for 2
> customers at the same time. This has happened in a load-balanced and
> non load-balanced environment.
> Thanks for any input.
> Kel Koenig
>
No comments:
Post a Comment