Wednesday, March 7, 2012

How to count up group number

Hi,
I have a report with a group and detail rows. I want to count up the groups
in the column groupnumber.
I tried the rownumber(<scope>) function.
If I use rownumber (Nothing) the detail rows were counted.
If I use rownumber("Groupname") the Report Server shows the number of detail
rows for each group.
Which scope should I use to count up the single groups?
Best regards,
StefanMaybe declare a global variable (i) in the Custom code and add this variable
in the value of a field in your group (i.e. =i+1)
"Stefoon23" wrote:
> Hi,
> I have a report with a group and detail rows. I want to count up the groups
> in the column groupnumber.
> I tried the rownumber(<scope>) function.
> If I use rownumber (Nothing) the detail rows were counted.
> If I use rownumber("Groupname") the Report Server shows the number of detail
> rows for each group.
> Which scope should I use to count up the single groups?
> Best regards,
> Stefan|||Hi Kyriakos,
your answer makes sense. But I couldn't get it to work!
How do I declare a custom global variable and how could I access it in the
report?
Best regards,
Stefan
"Kyriakos" wrote:
> Maybe declare a global variable (i) in the Custom code and add this variable
> in the value of a field in your group (i.e. =i+1)
> "Stefoon23" wrote:
> > Hi,
> >
> > I have a report with a group and detail rows. I want to count up the groups
> > in the column groupnumber.
> >
> > I tried the rownumber(<scope>) function.
> > If I use rownumber (Nothing) the detail rows were counted.
> > If I use rownumber("Groupname") the Report Server shows the number of detail
> > rows for each group.
> > Which scope should I use to count up the single groups?
> >
> > Best regards,
> > Stefan|||Add this code at your custom code section
============Public Shared i as integer
Public Function GetGrp() As Integer
i +=1
Return i
End Function
============
then call the function within a field on the group level, i.e. =Code.GetGrp()
That should do the count.
"Stefoon23" wrote:
> Hi Kyriakos,
> your answer makes sense. But I couldn't get it to work!
> How do I declare a custom global variable and how could I access it in the
> report?
> Best regards,
> Stefan
> "Kyriakos" wrote:
> > Maybe declare a global variable (i) in the Custom code and add this variable
> > in the value of a field in your group (i.e. =i+1)
> >
> > "Stefoon23" wrote:
> >
> > > Hi,
> > >
> > > I have a report with a group and detail rows. I want to count up the groups
> > > in the column groupnumber.
> > >
> > > I tried the rownumber(<scope>) function.
> > > If I use rownumber (Nothing) the detail rows were counted.
> > > If I use rownumber("Groupname") the Report Server shows the number of detail
> > > rows for each group.
> > > Which scope should I use to count up the single groups?
> > >
> > > Best regards,
> > > Stefan|||Hi Kyriakos, it worked perfectly!
Thanks for your help!
Stefoon
"Kyriakos" wrote:
> Add this code at your custom code section
> ============> Public Shared i as integer
> Public Function GetGrp() As Integer
> i +=1
> Return i
> End Function
> ============> then call the function within a field on the group level, i.e. =Code.GetGrp()
>
> That should do the count.
> "Stefoon23" wrote:
> > Hi Kyriakos,
> > your answer makes sense. But I couldn't get it to work!
> > How do I declare a custom global variable and how could I access it in the
> > report?
> >
> > Best regards,
> > Stefan
> >
> > "Kyriakos" wrote:
> >
> > > Maybe declare a global variable (i) in the Custom code and add this variable
> > > in the value of a field in your group (i.e. =i+1)
> > >
> > > "Stefoon23" wrote:
> > >
> > > > Hi,
> > > >
> > > > I have a report with a group and detail rows. I want to count up the groups
> > > > in the column groupnumber.
> > > >
> > > > I tried the rownumber(<scope>) function.
> > > > If I use rownumber (Nothing) the detail rows were counted.
> > > > If I use rownumber("Groupname") the Report Server shows the number of detail
> > > > rows for each group.
> > > > Which scope should I use to count up the single groups?
> > > >
> > > > Best regards,
> > > > Stefan|||Hi Kyriakos,
I wrote it works perfectly. It works when I Render the report the first
time. But when I choose other parameters the counting is not initialized.
Thus it does not start at zero but at the highest number.
e.g. I have a report with 5 group members for a group level the count would
go from 1 to 5 the first time I render the report. The second time the
numbers would reach from 6 to 10. ;-)
How could I initialize the value of the global variable every time the
report is rendered again? Or maybe it would be a solution to init the value
when the report has finished rendering.
Best regards,
Stefoon
"Kyriakos" wrote:
> Add this code at your custom code section
> ============> Public Shared i as integer
> Public Function GetGrp() As Integer
> i +=1
> Return i
> End Function
> ============> then call the function within a field on the group level, i.e. =Code.GetGrp()
>
> That should do the count.
> "Stefoon23" wrote:
> > Hi Kyriakos,
> > your answer makes sense. But I couldn't get it to work!
> > How do I declare a custom global variable and how could I access it in the
> > report?
> >
> > Best regards,
> > Stefan
> >
> > "Kyriakos" wrote:
> >
> > > Maybe declare a global variable (i) in the Custom code and add this variable
> > > in the value of a field in your group (i.e. =i+1)
> > >
> > > "Stefoon23" wrote:
> > >
> > > > Hi,
> > > >
> > > > I have a report with a group and detail rows. I want to count up the groups
> > > > in the column groupnumber.
> > > >
> > > > I tried the rownumber(<scope>) function.
> > > > If I use rownumber (Nothing) the detail rows were counted.
> > > > If I use rownumber("Groupname") the Report Server shows the number of detail
> > > > rows for each group.
> > > > Which scope should I use to count up the single groups?
> > > >
> > > > Best regards,
> > > > Stefan|||I could solve the puzzle by myself:
add some more custom code to your project
===================Public Shared i as integer = 0
Public Function GetGrp() As Integer
i +=1
Return i
End Function
Public Function InitGrp() As Integer
i=0
Return i
End Function
=======================
Put the Function InitGrp() to the page header.
Best regards,
Stefoon
"Stefoon23" wrote:
> Hi Kyriakos,
> I wrote it works perfectly. It works when I Render the report the first
> time. But when I choose other parameters the counting is not initialized.
> Thus it does not start at zero but at the highest number.
> e.g. I have a report with 5 group members for a group level the count would
> go from 1 to 5 the first time I render the report. The second time the
> numbers would reach from 6 to 10. ;-)
> How could I initialize the value of the global variable every time the
> report is rendered again? Or maybe it would be a solution to init the value
> when the report has finished rendering.
> Best regards,
> Stefoon
>
> "Kyriakos" wrote:
> > Add this code at your custom code section
> >
> > ============> > Public Shared i as integer
> >
> > Public Function GetGrp() As Integer
> > i +=1
> > Return i
> > End Function
> > ============> >
> > then call the function within a field on the group level, i.e. =Code.GetGrp()
> >
> >
> > That should do the count.
> >
> > "Stefoon23" wrote:
> >
> > > Hi Kyriakos,
> > > your answer makes sense. But I couldn't get it to work!
> > > How do I declare a custom global variable and how could I access it in the
> > > report?
> > >
> > > Best regards,
> > > Stefan
> > >
> > > "Kyriakos" wrote:
> > >
> > > > Maybe declare a global variable (i) in the Custom code and add this variable
> > > > in the value of a field in your group (i.e. =i+1)
> > > >
> > > > "Stefoon23" wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I have a report with a group and detail rows. I want to count up the groups
> > > > > in the column groupnumber.
> > > > >
> > > > > I tried the rownumber(<scope>) function.
> > > > > If I use rownumber (Nothing) the detail rows were counted.
> > > > > If I use rownumber("Groupname") the Report Server shows the number of detail
> > > > > rows for each group.
> > > > > Which scope should I use to count up the single groups?
> > > > >
> > > > > Best regards,
> > > > > Stefan|||:-)
"Stefoon23" wrote:
> I could solve the puzzle by myself:
> add some more custom code to your project
> ===================> Public Shared i as integer = 0
> Public Function GetGrp() As Integer
> i +=1
> Return i
> End Function
>
> Public Function InitGrp() As Integer
> i=0
> Return i
> End Function
> =======================> Put the Function InitGrp() to the page header.
> Best regards,
> Stefoon
> "Stefoon23" wrote:
> > Hi Kyriakos,
> > I wrote it works perfectly. It works when I Render the report the first
> > time. But when I choose other parameters the counting is not initialized.
> > Thus it does not start at zero but at the highest number.
> > e.g. I have a report with 5 group members for a group level the count would
> > go from 1 to 5 the first time I render the report. The second time the
> > numbers would reach from 6 to 10. ;-)
> >
> > How could I initialize the value of the global variable every time the
> > report is rendered again? Or maybe it would be a solution to init the value
> > when the report has finished rendering.
> >
> > Best regards,
> > Stefoon
> >
> >
> >
> > "Kyriakos" wrote:
> >
> > > Add this code at your custom code section
> > >
> > > ============> > > Public Shared i as integer
> > >
> > > Public Function GetGrp() As Integer
> > > i +=1
> > > Return i
> > > End Function
> > > ============> > >
> > > then call the function within a field on the group level, i.e. =Code.GetGrp()
> > >
> > >
> > > That should do the count.
> > >
> > > "Stefoon23" wrote:
> > >
> > > > Hi Kyriakos,
> > > > your answer makes sense. But I couldn't get it to work!
> > > > How do I declare a custom global variable and how could I access it in the
> > > > report?
> > > >
> > > > Best regards,
> > > > Stefan
> > > >
> > > > "Kyriakos" wrote:
> > > >
> > > > > Maybe declare a global variable (i) in the Custom code and add this variable
> > > > > in the value of a field in your group (i.e. =i+1)
> > > > >
> > > > > "Stefoon23" wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I have a report with a group and detail rows. I want to count up the groups
> > > > > > in the column groupnumber.
> > > > > >
> > > > > > I tried the rownumber(<scope>) function.
> > > > > > If I use rownumber (Nothing) the detail rows were counted.
> > > > > > If I use rownumber("Groupname") the Report Server shows the number of detail
> > > > > > rows for each group.
> > > > > > Which scope should I use to count up the single groups?
> > > > > >
> > > > > > Best regards,
> > > > > > Stefan

No comments:

Post a Comment