Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Accessing Boolean Group Conditions via API? Post Reply Post New Topic
Author Message
epaga
Newbie
Newbie


Joined: 18 Jun 2008
Online Status: Offline
Posts: 15
Quote epaga Replybullet Topic: Accessing Boolean Group Conditions via API?
    Posted: 18 Jun 2008 at 11:52pm
Hi there,
I can access date group conditions via the API, but for some reason the same idea does not work for boolean group conditions (such as grouping on "change to yes" or "change to no", etc.).

Here's my code:

foreach( Group g in dataDefinition.Groups ) {
    if( g.Options is DateGroupOptions ) {
       Console.WriteLine("is date group! condition: "+
            (((DateGroupOptions)g.Options).DateCondition));
    } else if( g.Options is BooleanGroupOptions ) {
       Console.WriteLine("is boolean group! condition: "+
            (((BooleanGroupOptions)g.Options).BooleanCondition));
    }
}

I have a date-based group "by year" and another boolean-based group with "change to yes". But only the date group line is written to the console. Why? Is there some other way to work around this problem? I've even been thinking of workarounds like adding a group name field based on the boolean group to the report in order to get its formulaform in order to parse the formulaform in order to get the boolean condition. yeah, that seems crazy but if it's the only way to get the info?

Any thoughts would be most welcome, thanks.

BTW, if this isn't possible via the API, this might be an idea for a new chapter for your new book: "Things you CAN'T do with the API." ;)
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 24 Jun 2008 at 12:25am
Re your question, I would have to build a sample report to recreate this scenario and play around with it to figure out why it doesn't print. But my initial guess is that you need to do a ToString() on it, or a similar conversion to get it into printable format.

Re your suggestion for a new chapter on "Things you CAN'T do with the API", this would actually be a full book unto itself. What they really want you to do is upgrade to CR 2008 and once you do that, the API increases dramatically (the whole point of putting CR in .NET is for the up-sell anyway).
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
epaga
Newbie
Newbie


Joined: 18 Jun 2008
Online Status: Offline
Posts: 15
Quote epaga Replybullet Posted: 24 Jun 2008 at 2:42am
Actually the ironic thing is I'm trying to do this (and the scenarios described in the other threads) with the CR2008 .NET API! ;)

As you can see in the code, the GroupOptions is not a BooleanGroupOptions, so a ToString doesn't help there. :-(
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 24 Jun 2008 at 2:32pm

You're using CR 2008 .NET API? Bummer. I'm going to dig into this deep once I finish the other chapters in my book...

When you look at BooleanGroupOptions in debug mode, what do you see? Is there any value displayed? Is it an enumerated list you could use in a custom function that would return a string value?
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
epaga
Newbie
Newbie


Joined: 18 Jun 2008
Online Status: Offline
Posts: 15
Quote epaga Replybullet Posted: 25 Jun 2008 at 1:29am
yeah i already tried all that. :-( oh, well...

thanks, though!
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.016 seconds.