Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Conditionally display toolbar icons in CRViewer Post Reply Post New Topic
Author Message
N11689
Newbie
Newbie


Joined: 13 Jun 2007
Location: United States
Online Status: Offline
Posts: 22
Quote N11689 Replybullet Topic: Conditionally display toolbar icons in CRViewer
    Posted: 04 Sep 2007 at 12:47pm
I am using VB.NET (2005) as an interface between our software application and Crystal Reports to display the Crystal Reports we have developed (in Crystal XI Release 2).

I have created a .NET solution with a module and a form. All the coding is done in the module. I use Form1.ShowDialog() to bring up the CrystalReportViewer (which was added to the form).

The problem I am having is that I need to programmatically change some of the Report Viewer properties depending on how the report was created. As an example: Some of our reports have the Report Option, Create Group Tree, selected, others do not. Regardless of how this option is set in the original report, the Group Tree icon is showing in the report viewer. I only see how to set this property to True or False. How can I pass the report's property setting to the viewer?
 
Any help would be appreciated. Thank you
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 04 Sep 2007 at 1:38pm
There might be someone else with a better solution.
 
My thinking is that you will have create logic that will set the ShowGroupTree property condionally. You would probably do this based on report name. In the Viewer load statement you could create logic something like this:
 
IF reportname1.rpt THEN ViewerName.ShowGroupTree = TRUE
else if reportname2.rpt then ViewerName.ShowGroupTree = FALSE
END IF
 
The only otherway I can think of is to create a separate form and viewer for each report and call those from your main form.
 
Both have drawbacks especially if you have a number of different reports.
 
Hope this is of some help.
 
Regards,
 
John W.
IP IP Logged
N11689
Newbie
Newbie


Joined: 13 Jun 2007
Location: United States
Online Status: Offline
Posts: 22
Quote N11689 Replybullet Posted: 05 Sep 2007 at 5:16am
Ahhh...if only it were that easy.  We have 500+ reports that our clients can call from our software application.  We use the VB.NET program to execute the report they selected.  So, I really need to know the grouptree value for each report, pass that in so the viewer can conditionally display it depending on which report was selected.
 
The CRViewer for Crystal 9 VB components automatically did this.  It appears that Business Objects has left this out of the Crystal Reports for .NET assemblies unless someone knows otherwise.
 
Thanks
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 05 Sep 2007 at 10:35am
Yikes 500+ reports....
 
I have only spent a few minutes looking at the issue. It does appear that the property for the GroupTree (CR XI) is in the viewer object and not the report object. So unless its buried somewhere, other than all the usual places, you may be out of luck. 
 
I suppose there are workarounds such as setting and then  reading a value in the report summary info that would tell the viewer whether or not to open the group tree.  I believe the summary info properties are part of the report object.  Other than something like that I have no more suggestions at this point. I'll  keep looking around if I run across something I will certainly post it.
 
Let us know if find a good solution and I am sorry I could not be of more help.
 
Regards,
 
John W.
 
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 05 Sep 2007 at 11:34am
I gotta run to a meeting and don't have time to look into this right now. But I know that when BOBJ went from COM to .NET they dropped a lot of properties from the object model. I don't understand how they want us to upgrade from VB6 to .NET but then don't give us all the functionality we used to have. Anyway, I wonder if there is a way to create a formula in your report which just has the value of the group tree flag. Maybe this is under the Special Fields? I don't know (never thought about it till now). But if that is possible, you would have to go into each report (ouch!) and create that formula (or manually set it to true or false) and then in your VB app you could look at the value of that formula to see whether the group tree should be on or off. Yes, its still a pain, but it might be feasible to try.  That's the best I can think of....
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 05 Sep 2007 at 11:37am
oh - one more idea (it's a bit of a stretch). Build a VB6 app which loops through every report in your report folder and builds a table that lists the report name and whether it has grouping or not (using the older functionality). Then your VB.NET app can use John's idea to look at the report name and turn it on or off. It's a hack, but your options aren't all the great right not. Gotta run.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
N11689
Newbie
Newbie


Joined: 13 Jun 2007
Location: United States
Online Status: Offline
Posts: 22
Quote N11689 Replybullet Posted: 05 Sep 2007 at 11:41am
I complete agree on your statement:
 "I don't understand how they want us to upgrade from VB6 to .NET but then don't give us all the functionality we used to have."  Especially when Bus. Obj has told me they will not fully support the RDC with VB.NET so we should use the Crystal Reports for .NET assemblies.  It's VERY frustrating!
 
I will try suggestions from both of you and see what I come up with. 
 
In the meantime, if anyone (or I) find anything on this in the near future, please update this topic.  Thank you.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.027 seconds.