Joined: 05 Feb 2014
Online Status: Offline
Posts: 85
Topic: .NET questions Posted: 12 Mar 2020 at 5:02am
Hello:
I was hoping there where a few .NET gurus here that could help me understand some basic programming using the CRYSTALDECISIONS.SHARED and CRYSTALDECISIONS.ENGINE assemblies.
First off, here is my Powershell code to load a report, set parameters, and then displays the parameters for viewing on the screen.
foreach ($parameterField in $report.DataDefinition.ParameterFields)
{
write-output "The current value of:"
$parameterField.Name
write-output "In report:"
$parameterField.ReportName
write-output "is:"
$parameterField.CurrentValues.Value
write-output "Of kind:"
$parameterField.DiscreteOrRangeKind
write-output "-------------------"
}
QUESTION 1
What exactly does HASRECORDS do? If I leave out that line, the report has no data and is blank. Is HASRECORDS basically an 'execute' command?
QUESTION 2
The FOREACH loop at the end simply shows parameter values for each parameter, but the parameters on the sub report never show anything. How do I access the values of the sub reports?
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Posted: 20 Apr 2020 at 5:47am
I haven't done this in Power Shell, however, I hope I can point you in the right direction.
1. I would replace "HasRecords" with "Refresh" to run the report.
2. To get to the parameters for the subreport, you actually have to walk through the sections of the report in code to find the subreports and pull the parameters from individual subreports just like you're doing for the main report. In fact, I'm surprised your report is even running because I don't see where you're setting the credentials for the database connections, which you also have to do for each subreport as well as the main report.
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