All...
I am using vb.net 2003. i am trying to set report groupings of a crystal report at runtime based on user defined options. MSDN says this:
Dim FieldDef As FieldDefinition
FieldDef =
Report.Database.Tables.Item(0).Fields.Item(comboBox1().Text)
Report.DataDefinition.Groups.Item(0).ConditionField = FieldDef
However, the .ConditionField is Read Only, you cannot assign anything to it. I have searched the object browser at each level of this object model, and cannot figure out how to assign a group to a report.
Heres the link to MSDN... the code for SORTING cr at runrime works perfectly, its just the GROUPING code im having trouble with...
http://msdn.microsoft.com/library/d...resentation.asp
Thanks.The following Example is specific to Crystal Reports 8.5 using RDC and VB6, but you may be able to tweak it a bit to work for you...
The following code can be used to Change the Group through VB Code:
1. In Crystal, create a Formula Field and add 1 column (a String column works best).
2. Insert a Group and choose your Formula for the GroupBy.
3. Now, you can comment out the Column you entered, or you can leave it there, your choice.
4. In VB, add this line of code, substituting {ttxFileName.ColumnName} for the column you want to sort by: Report.FormulaFields(1).Text = "{ttxFileName.ColumnName} ". The FormulaFields can only take a long for the index, so you need to know what number your Formula is so you don't replace the wrong one. The numbers start at 1 and are incremented based on the order they were created (they are listed in chronological order).
Showing posts with label groupings. Show all posts
Showing posts with label groupings. Show all posts
Friday, March 23, 2012
Wednesday, March 21, 2012
Grouping
Is there a way to fully expand (or vice versa) a report with groupings and
hidden levels? (Something like the Excelâ's subtotal groupings functionalities
would be ideal). The picture below displays exactly the two controllers we
requireâ?¦ (normal and level expand)You could do this by having a boolean report parameter called something like
HideDetail. Then in the detail row's hidden property use the expression
=Parameters!HideDetail
You could use similar parameters for a multi-level grouped report.
HTH,
--
Magendo_man
Freelance SQL Reporting Services developer
Stirling, Scotland
"Kostas Bourikas" wrote:
> Is there a way to fully expand (or vice versa) a report with groupings and
> hidden levels? (Something like the Excelâ's subtotal groupings functionalities
> would be ideal). The picture below displays exactly the two controllers we
> requireâ?¦ (normal and level expand)sql
hidden levels? (Something like the Excelâ's subtotal groupings functionalities
would be ideal). The picture below displays exactly the two controllers we
requireâ?¦ (normal and level expand)You could do this by having a boolean report parameter called something like
HideDetail. Then in the detail row's hidden property use the expression
=Parameters!HideDetail
You could use similar parameters for a multi-level grouped report.
HTH,
--
Magendo_man
Freelance SQL Reporting Services developer
Stirling, Scotland
"Kostas Bourikas" wrote:
> Is there a way to fully expand (or vice versa) a report with groupings and
> hidden levels? (Something like the Excelâ's subtotal groupings functionalities
> would be ideal). The picture below displays exactly the two controllers we
> requireâ?¦ (normal and level expand)sql
Group sums wrong in Matrix
Banging my head against the wall on this one.
Running a matrix report in RS 2000. I have 2 groupings, Department and
Company. I want to get a sum of total hours for each job code and
Department and Company. The job code hours show up in the detail, as
=Iif (Len(sum(Fields!HoursTotal.Value)) = 0 , 0,
sum(Fields!HoursTotal.Value ))
When I run the report, the sum for the department is off.
Job A 8.0
Job B 0.0
Job C 8.2
Job D 71.1
Job E 99.5
--
Group Sum 186.7 (should be 186.8)
Any idea of what is wrong?
The Stored procedure returns values to 1 decimal place as a double.
Joewhy do you want to use:
Iif (Len(sum(Fields!HoursTotal.Value)) = 0 , 0,
sum(Fields!HoursTotal.Value ))
can you try
Iif (sum(Fields!HoursTotal.Value) = 0 , 0,
sum(Fields!HoursTotal.Value ))
or
Iif (sum(Fields!HoursTotal.Value) = 0.0 , 0,
sum(Fields!HoursTotal.Value ))
to see what happen?
in format of group sum, set it to n2 and see what happen?
"Jsarna" wrote:
> Banging my head against the wall on this one.
> Running a matrix report in RS 2000. I have 2 groupings, Department and
> Company. I want to get a sum of total hours for each job code and
> Department and Company. The job code hours show up in the detail, as
> =Iif (Len(sum(Fields!HoursTotal.Value)) = 0 , 0,
> sum(Fields!HoursTotal.Value ))
> When I run the report, the sum for the department is off.
> Job A 8.0
> Job B 0.0
> Job C 8.2
> Job D 71.1
> Job E 99.5
> --
> Group Sum 186.7 (should be 186.8)
> Any idea of what is wrong?
> The Stored procedure returns values to 1 decimal place as a double.
> Joe
>
Running a matrix report in RS 2000. I have 2 groupings, Department and
Company. I want to get a sum of total hours for each job code and
Department and Company. The job code hours show up in the detail, as
=Iif (Len(sum(Fields!HoursTotal.Value)) = 0 , 0,
sum(Fields!HoursTotal.Value ))
When I run the report, the sum for the department is off.
Job A 8.0
Job B 0.0
Job C 8.2
Job D 71.1
Job E 99.5
--
Group Sum 186.7 (should be 186.8)
Any idea of what is wrong?
The Stored procedure returns values to 1 decimal place as a double.
Joewhy do you want to use:
Iif (Len(sum(Fields!HoursTotal.Value)) = 0 , 0,
sum(Fields!HoursTotal.Value ))
can you try
Iif (sum(Fields!HoursTotal.Value) = 0 , 0,
sum(Fields!HoursTotal.Value ))
or
Iif (sum(Fields!HoursTotal.Value) = 0.0 , 0,
sum(Fields!HoursTotal.Value ))
to see what happen?
in format of group sum, set it to n2 and see what happen?
"Jsarna" wrote:
> Banging my head against the wall on this one.
> Running a matrix report in RS 2000. I have 2 groupings, Department and
> Company. I want to get a sum of total hours for each job code and
> Department and Company. The job code hours show up in the detail, as
> =Iif (Len(sum(Fields!HoursTotal.Value)) = 0 , 0,
> sum(Fields!HoursTotal.Value ))
> When I run the report, the sum for the department is off.
> Job A 8.0
> Job B 0.0
> Job C 8.2
> Job D 71.1
> Job E 99.5
> --
> Group Sum 186.7 (should be 186.8)
> Any idea of what is wrong?
> The Stored procedure returns values to 1 decimal place as a double.
> Joe
>
Subscribe to:
Posts (Atom)