Crystal Reports - Command Line CRExport.exe Odd Formula Error - crystal-reports

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)

Related

Crystal Report's Report Viewer "A statement is expected here"

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.

Crystal Report: Parameter damages the whole report

While using Crystal Reports I have encountered a strange bug, that repeats itself already with a number of my reports.
I still didn't fully get how I replicate it, but usually it goes as follows:
I add a parameter of any type to an existing report document, however it doesn't appear in a parameter prompt at all.
After I change parameter order in the Parameter Fields Section, my Parameter disappears and instead I see a duplicate of another parameter in a parameter list, and in the "Set Parameter Order"-Window I see this duplicated parameter as [ParameterName, ParameterName]. If I save the document in this moment and try to reopen it, CR crushes.
If I try to load this document in Vstudio with CREngine, the code exits with the message "Access violation".
Here is a pic of what is happening:
The reason you are not being prompted for the new "test" parameter is that it is not used by the report for anything.
The rest of the behavior is indeed strange. Consider removing the '#' character from the name of the first parameter to see if that fixes it.
If some of those parameters are from a stored procedure, perhaps your report is simply out of sync with the data source. Do Database, Verify Database...

my report run but does not display anything in oracle

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 = &parameter_one
Parameter two = &parameter_two

Invalid Name Error - Crystal Reports in VB6

I'm trying to set the title of a crystal report in VB6, but I keep being shown an error.
The parameter field that I want to set the text of is called txtTitle.
However, when running this code, it gives an error saying
Invalid Name
If opt_sales_ledger.Value = True Then
crxReport.ParameterFields.GetItemByName("txtTitle").AddCurrentValue ("List of Sales Ledger Accounts")
ElseIf opt_purchase_ledger.Value = True Then
crxReport.ParameterFields.GetItemByName("txtTitle").AddCurrentValue ("List of Purchase Ledger Accounts")
End If
What's causing the error?
Crystal is looking for a "parameter" type field called "txtTitle" and it cannot locate it. I usually use formulas for this purpose, in other words "txtTitle" would be a formula in the report and defined and/or initialized as a stringVar
Try to use this way:
crxReport.ParameterFields(1).AddCurrentValue ("your_first_parameter_value")
crxReport.ParameterFields(2).AddCurrentValue ("your_second_parameter_value")
Good luck!

INSTR in Crystal

We are using this function to filter data by program codes entered, if nothing is entered return all?
Can any one please explain this Crystal function, and how Crystal works with it? Mainly the last statement.
Here is some information that might be useful.
{?Program} ==> Parameter to accept different programs codes in the following form
303&410&110
{Command.program_code} ==> Field were program code is stored
if ({?Program} = "")
then true
else
(INSTR("&" & {?Program} &"&", "&"& {Command.program_code} & "&")>0)
Thanks...