on 2024 Aug 16 8:25 PM
I have a COM UFL written in Visual Basic. Been working for years with CR2016 designer and SP34 of the Crystal Reports for Visual Studio. 32 bit. My database has had a INT64 (DBTYPE_I8) column added to it, and I'd like to do some custom formatting with this value. My reports can read the column just fine, display it as a number, etc, but I want to pass it to a UFL function as a 64 bit int. In Visual Basic, visual studio 2019, a Long datatype is an INT64. So I added the world's simplest function to the UFL:
Public Function TestLong(ByVal value as Long) As String
TestLong := "TestLong"
End Function
I'm not calling this function in the report, but it is in the dll. I regasm'd it, copied it hither and yon, etc etc just like always. Yet the mere presence of this function causes my DLL not to load. In CR2016 I get the 'saved data will be discarded since one or more formulas failed to compile' and from CRforVS, at runtime, I get the infamous 'UFL u212com.dll that implements this function is missing'.
Obviously Crystal is not liking my UFL with this function using a Long parameter.
I recompiled as 64bit, regasm'ing the 64 bit version, and used CR2022. Same results. If I take this function out of the dll, all is well. Put it in, fails.
I also changed Long to Int64 in the VB code to see if that made any difference. Same results.
Anyone have any ideas? Anyone using a COM UFL with a function taking an INT64 parameter?
Request clarification before answering.
Most likely, your record selection is using a Crystal function, forcing the filtering to be done by Crystal rather than by the DBMS. Google the topic of "optimizing Crystal Reports" and you'll see various tips on how to avoid that problem.
Since you are familiar with creating UFLs, you could implement the SQL conversion using a formula that uses a UFL function that calls the SQL statement and returns the result of the conversion.
Ken Hamady maintains a listing of 3rd-party UFLs here. My CUT Light UFL provides such an SQL function.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem you are having is due to CR 2016 is a 32 bit application, it can't handle 64 bit integers. 15 digits plus one for the sign is all it can handle, always been that way, it's the nature of C++ Int's.
You could try CR 2020, it's 64 bit and see this KBA on how to create a C++ or COM UFL:
Other than that Ido's work around is one option, the other is to use a Stored Procedure to break the value into 2 parts and put them back together using a field object and drop the most significant+least significant field into the object so they appear as one value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sounds like you simply need to create an SQL Expression.
No need for a UFL for such a simple case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use Integer. If you need to accommodate larger values, pass as String and convert on either side of the method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
31 | |
9 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.