rbaldwin
Posts: 172
|
| Posted: 04/02/2012, 5:49 AM |
|
I have a Report Page, the report is named Report1, in the detail row i have a column named AvgScore, how do i:
a) get the current value of AvgScore
b) set AvgScore to a new value
In a non Inmotion report page i would have simply coded:
Dim curValue as String
curValue = Report1AvgScore.Text
Report1AvgScore.Text = "someNewValue"
Your help is appreciated.
And yes i know this should be posted in the inMotion forum, but that forum gets little traffic.
|
 |
 |
rbaldwin
Posts: 172
|
| Posted: 04/02/2012, 8:33 AM |
|
After some struggling with the examples, here i provide my own solution.
dim avgScore as string
dim averageScore as Double
dim sumOfScores as double = Report1.GetControl(Of MTHidden)("sumOfScores").Value
dim numOfHosts as double = Report1.GetControl(Of MTReportLabel)("Num_Hosts").Value
if numOfHosts = "0" then
avgScore = ""
else
averageScore = sumOfScores / numOfHosts
avgScore = formatNumber(averageScore,0)
end if
CType(sender, MTReportLabel).Text = avgScore
|
 |
 |
cvboucher
Posts: 191
|
| Posted: 04/02/2012, 8:41 AM |
|
In the BeforeShow event of the AvgScore field you can do the following (VB.Net InMotion).
Dim curValue As String = CType(sender, MTReportLabel).Text
CType(sender, MTReportLabel).Text = "someNewValue"
Or
Dim MyFieldName As MTReportLable = CType(sender, MTReportLable)
Dim curValue As String = MyFieldName.Text
MyFieldName.Text = "someNewValue"
Or
Dim curValue As String = Report1.GetControl(Of MTReportLabel)("avgScore").Text
Report1.GetControl(Of MTReportLabel)("avgScore").Text = "someNewValue"
Also, for numeric fields I like to set Value property so the formatting is handled for me based on the field properties. If the field's format is set with two decimal places you can
CType(sender, MTReportLabel).Value = 82.443453343
and the field will be formatted on the report with just the two decimal places.
HTH,
Craig
|
 |
 |
|