Home > Back-end >  CR 10 for Sage: Passing Parameter via Crystal Reports Ninja with Powershell Script - Field Compatibi
CR 10 for Sage: Passing Parameter via Crystal Reports Ninja with Powershell Script - Field Compatibi

Time:06-21

I receive the following error message when running a Powershell script:

The types of the parameter field and parameter field current values are not compatible.

Details:

There are 3 parameters in the Report:

BeginDate
EndDate
Owner

The parameter for "Owner" is static and will not change

The following variables were created in PS to calculate the first and last day of the previous month:

$FirstDayMonth = (Get-Date -Day 1).AddMonths(-1).ToString("MM/dd/yyyy")

$LastDayMonth = (Get-Date -Day 1).AddDays(-1).ToString("MM/dd/yyyy")

The following is the section of code used by PS / Crystal Reports Ninja to pass the Parameters to Crystal:

-a "BeginDate:($FirstDayMonth)" -a "EndDate:($LastDayMonth)" -a "Owner:3001"

Google brings up matching the data types, but no direction on how.

Any help would be appreciated

Thank you

EDIT:

Here's the error message I receive when I remove the Parentheses around the Date Variables:

Exception: Error in File LSFMoveReport 25544_25504_{6ED7AB69-4987-4705-8854->0C3CE21FC7B5}.rpt: Operation illegal on linked parameter. Inner Exception: System.Runtime.InteropServices.COMException (0x80000290): Error in File LSFMoveReport 25544_25504_{6ED7AB69-4987-4705-8854->0C3CE21FC7B5}.rpt: Operation illegal on linked parameter. at >CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(Expor>tOptions pExportOptions, RequestContext pRequestContext) at >CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportReq>uestContext reqContext)

CodePudding user response:

Is it as simple as not needing the brackets around the date parameters? e.g. the brackets are for a date range parameter:

-a "BeginDate:$FirstDayMonth" -a "EndDate:$LastDayMonth" -a "Owner:3001"

CodePudding user response:

Linked parameters are subreport parameters that obtain their values from main report values passed to them as links established in the report design.

You should not try to set the values of such parameters directly.

  • Related