I am using Crystal Reports 2016 and am trying to get a QR code solution to work in Report Viewer. The QR code prints flawlessly with the packaged QR font in the Crystal Reports editor, but in Report viewer, it throws an "A statement is expected here" error (see screenshot).
The code I am using is the QR solution vendor's code inside a formula field with Basic syntax:
ConnectCodeClassQRCodeEncode ({search_loc.LOC_DESC},"L",8)
Dim x As Number
Dim Result As String
For x = 1 To ConnectCodeClassQRCodeNumBlocks()
Result=Result + ConnectCodeClassQRCodeGetBlocks(x)
Next x
formula = Result
Is Report Viewer expecting Crystal Syntax instead of Basic Syntax? Or is Report Viewer not knowing where to find the ConnectCodeClassQRCodeEncode function?
TIA
You need to install the UFL providing that function on the target machine.
Related
I am working with Crystal Reports 11.5.10.1263 [CR Developer Type: Full].
I am familiar with Programming and SQL syntax in general and have worked with expressions in SSRS & MS Access but never in Crystal Reports.
Problem:
I modified the SQL in the Crystal report and it has had the desired effect - except in the last part of the report output - where the changes I made to the SQL do not have the desired effect.
The 'desired effect' is that when a field named 'FundNumber' has the values '2595', '2597' Then the field named 'Organization' should be assigned the value '41600'.
The Detail Record in the Report has the following three rows as part of its 'Formula':
+ IIf({Data.Payments} > 0, "+01W ", "-01W ")
+ Left({Data.FundNumber}+ SPACE(6),6)
+ Left({Data.Organization}+ SPACE(6),6)
I want to change the Data.Organization row to an IIF Statement that says [pseucode]:
IIf Data.FundNumber IN ["2595", "2597"] Then "41600" Else Data.Organization
I believe the Left() function is saying 'return the left 6 characters of [Data.Organization + 6 Spaces] ?? and that it has to do with the way the data is presented in the output.
I would appreciate help with creating the IIF statement for this.
I included the 'IIf({Data.Payments} ...' row in case that helps - as my google searches have turned up examples that use IF instead of IIF.
Thanks!
The syntax most of the time is the same as VB. Try
IIF({Data.FundNumber} = "2595" or {Data.FundNumber} = "2597", "41600", {Data.Organization})
I have designed report in 10g. When I call report through forms 10g than report executed but do not display anything. Kindly help me what I have to do to resolve this issue. I use .rep report and desformat is PDF. One thing more when in this desformat my report started downloading instead of giving a preview in internet explorer and downloaded pdf is empty (contain nothing).
Report displays the result of a query. So the most obvious question is: does the query, when you run it outside of the Forms/Reports application, work correctly and returns the result?
If it accepts certain parameters, verify that they are correctly passed. Mind the datatype, especially if DATE is involved as people usually have problems with different format masks, NLS settings and stuff.
Also, check whether those parameters are obligatory or not. If not, report's query should contain something like
where (some_value = :parameter_value or :parameter_value is null)
Furthermore, make sure that all those parameters are passed to the report. You can display their values in the report, just to see what's going on. Open Reports Paper Layout Editor, go to the margin and - using the ampersand notation - display those values, such as
Parameter one = ¶meter_one
Parameter two = ¶meter_two
I built a report in crystal reports (version 11.5.12.1838 - yes it's old, but I have no ability to upgrade it, it comes with the software we use for cash reporting).
I have this formula:
if (DateTime({#Date1}) = Datetime({rpcRGHL5DayBalanceView;1.1date}))
then
{rpcRGHL5DayBalanceView;1.1}
else
999999999999.99
The report runs and exports fine within crystal as well as the application we use. However, when using CrExport.exe (free command line tool) the report fails to generate and provides this error.
Error : A string is required here. Details: errorKind Error in File RGHL-5DayBalanceView {25B5C1DE-4C71-4A2D-816E-165F95A6B03B}.rpt:
Error in formula Balance1:
'if (DateTime({#Date1}) = Datetime({rpcRGHL5DayBalanceView;1.1date}))
then ' A string is required here. Details: errorKind
This seems to happen when the parameter I pass in via the command line differs from the stored value on the report. If I pass in the same value, the report generates, but the data is not updated. The data that was saved on the report is what I get.
I use this CrExport.exe with several other reports with no problem. Not sure if it's a bug in the command line tool or not.
Also, if I change the values from numeric to text via this code.
if (DateTime({#Date1}) = Datetime({rpcRGHL5DayBalanceView;1.1date}))
then
ToText({rpcRGHL5DayBalanceView;1.1},0)
else
ToText(999999999999.99)
Then I get this error from the command line program.
Error : Too many arguments have been given to this function. Details: errorKind
Error in File RGHL-5DayBalanceView {98633D00-5B70-4B7D-839C-1D0CEB359AE9}.rpt:
Error in formula Balance1: 'if (DateTime({#Date1}) = Datetime({rpcRGHL5DayBalanceView;1.1date})) then
'Too many arguments have been given to this function.
Details: errorKind
Any help is much appreciated. Let me know if more information is needed and I will do what I can to provide it.
try like this:
if (DateTime(CStr({#Date1})) = Datetime({rpcRGHL5DayBalanceView;1.1date}))
then
ToText(CStr({rpcRGHL5DayBalanceView;1.1}),0)
else
ToText(999999999999.99)
I have two different SAP Crystal Reports, one has sub reports and the other doesn't. For whatever reason the simple CR prints to the printer, to PDF and to the viewer just fine. The CR with subreports only prints to PDF for whatever reason. This is leading me to believe there's nothing inherently wrong with the report itself otherwise it wouldn't work when I save to PDF.
A snippet of my code is below (in VB):
Select Case PrintMedia
Case PrintType.Printer
crOrderPrintout.PrintToPrinter(1, False, 0, 0)
Case PrintType.Viewer
Dim frmReportViewer As New frmReportViewer
frmReportViewer.CrystalReportViewer1.ReportSource = crOrderPrintout
frmReportViewer.ShowDialog()
Case PrintType.File
crOrderPrintout.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, String.Format("C:\Documents and Settings\{0}\Desktop\{1}.pdf", mdlSharedVars.StripDomainFromFullUsername(WindowsIdentity.GetCurrent.Name), ReceiptID))
Case Else
crOrderPrintout.PrintToPrinter(1, False, 0, 0)
End Select
For clarification the PrintMedia is a variable whose type is a custom enum of mine, PrintType.
When I try to show the report with the subreport in the viewer or print to printer I get a "Index was out of range. Must be non-negative and less than the size of the collection.
Parameter: index." error. Yet the simple, non-subreport CR works just fine regardless of the PrintMedia.
Don't suppose anyone has any ideas??
After fighting with this for longer than I care to imagine, it turns out there was a problem with one of the fields in the crystal report display string. Basically I started the report from scratch, adding in piece by piece trying to isolate the error.
Can you try the report in an off the shelf Crystal viewer or Crystal Reports itself? Does it work?
Maybe try setting the printer options in page setup to "No Printer (Optimize for screen display)"
Is there a function or any way I could print the username of the user taking the print out of a report in CR 8.5??
This could be the windows user name or user name pertaining to a system like IFS where the reports are being generated from.
If you are using C#, you can pass in System.Environment.Username as a parameter to your report.
EDIT: (Thanks rexem)
If you were using CR V10 and BusinessObjects Enterprise you could look into using CurrentCEUserID in a formula field.