Writing Code
 Crystal Reports Forum : Crystal Reports .NET 2003 : Writing Code
Message Icon Topic: Merging SelectionFormula with CR Select Expert Post Reply Post New Topic
Author Message
wattsjr
Groupie
Groupie
Avatar

Joined: 25 Jun 2007
Location: United States
Online Status: Offline
Posts: 51
Quote wattsjr Replybullet Topic: Merging SelectionFormula with CR Select Expert
    Posted: 14 Aug 2007 at 11:14am
I am rewriting a number of CR reports that were written with CR 6 and run under VB6.
 
Now I'm using VB.NET 2003 with the embedded CR designer.
 
The old reporting application used a combination of selection criteria using the CR Select Expert and selection criteria supplied (through VB) by the User at Run Time .
 
I'd like to continue using that method, but the new .Net version seems to ignore the CR Select Expert string.
 
I know that I can add the Select Expert code to the VB module, but there will be times when I will want to change the Selection Criteria in the Report without having to recompile (and redistribute) the VB app.
 
My new VB app uses the "CrystalReportViewer1.SelectionFormula" to pass the selection criteria to the report.
 
Any suggestions on how I can make this work?  Any help will be appreciated.
-jrw
IP IP Logged
wattsjr
Groupie
Groupie
Avatar

Joined: 25 Jun 2007
Location: United States
Online Status: Offline
Posts: 51
Quote wattsjr Replybullet Posted: 14 Aug 2007 at 1:14pm
Sometimes just asking the question makes me think in a different direction.  I've come up with a solution that seems to do what I need it to.
 
To be fair, I got most of the solution from someone named "Micha" over on the Business Objects Forum (7287 in relpy to 7063).  It just took me awhile to understand what he was saying and then do my own coding and testing.
 
The solution is:
1. Check the length of the .RecordSelectionFormula, to see if it contains data.
2. Then either concatenate it with the VB selection string into the .SelectionFormula when there is data or just move the VB selection string to the.SelectionFormula when there isn't any data.
 
This will allow you to utilize both the CR Report Expert selection string AND the VB Runtime selection string.
 
Here is an example of how it worked for me:
 
If Len(crReportDocument.RecordSelectionFormula) > 5 Then
vCNDBReport.CrystalReportViewer1.SelectionFormula = "(" & crReportDocument.RecordSelectionFormula & ") AND " & Select_String
Else : vCNDBReport.CrystalReportViewer1.SelectionFormula = Select_String
End If
 
This could also be a possible solution for gee5767 with his question back in March ("Select Expert setting being ignored").
 
Regards,
 
 
-jrw
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.