cancel
Showing results for 
Search instead for 
Did you mean: 

Import/translate .rpt file

Former Member
0 Kudos

Post Author: f'lar

CA Forum: Crystal Reports

I work for a medical billing company. We take reports from our

clients, import them into our system, and then bill insurance or

patient as appropriate. I'm a programmer who is responsible for

writing routines to parse the various formatted files from our

clients. I have never used crystal reports. We have two

clients that send us .rpt files. Of those two sets of .rpt files, one

set is human-readable if I open it in a text editor, so it's no big

deal. The other I have no idea. We have a windows 2000 machine that

we leave running all the time that was set up by a previous programmer

that converts the .rpt files to a usable format (I'll accept .txt,

.csv, .xls, .rtf, or .pdf, among others). I'm not real happy with this

solution because if that machine dies we're up a creek, but this is the

way it's always been. We can't get the program that runs on that

machine to work on any of our other machines (windows xp or server

2003).

I've tried several things to open the .rpt files myself,

including several variety Visual Studio projects and (free or trial)

3rd party viewers. The result is always that whatever application

tries to open the file hangs, and I have to kill the process. I was

finally able to get a file to display something reasonable in Visual

Studio by creating a new report using one of my existing files as a

template. But it's just the layout and formulas for the file rather

than any actual data.

Eventually I had a breakthrough, where I got a dialog box asking

me for connection information for a sql server on the clients network.

I shouldn't need to use this connection, since all the data I care

about is in included in the files from the client. I was able to avoid

the crashes by supplying real (but incorrect) sql server connection

info. At least then I could look at the design view in Visual Studio.Based

on that I on this I have a small program that attempts to load a file

with the template I made and export it to rtf. Unfortunately, it's not

working. First of all, it takes over a minute to load the file, I

figure that is mostly waiting for a timeout from my incorrect database

(which I don't need). In fact, each individual property access takes

that long. When it's finally loaded when I try to export it will give me an error about parameters. I can

see the parameters in the design view, but I can't remove them because

of dependencies I don't know how to find. I worked up some code so that it will prompt me, but If I go ahead and enter

parameters manually (I will need this to be automated) it will eventually

just hang completely (I left it overnight with no progress) on

the ExportToDisk statement.Like I said earlier, I have not used Crystal Reports before. I don't even know which version is used to create the .rpt files. I would really appreciate any tips on how to convert these files into a usable format. I get the feeling I'm going about this the hard way, and there must be something simple I can do to just tell the CR engine to use the file as the datasource.Some additional InformationI sometimes see this error message:Error in formula <CompletedDate>. 'stringVar sDTTM := CStr({vusrPatientExamInfo.CompletedDTTM}, 'MM/dd/yyyy h:mm tt');'The remaining text does not appear to be part of the formula.I considered the possibility that the windows 2000 machine was set up to know how to connect to the client's database mentioned above, but I looked into that and this isn't the case. We've been getting these reports from the client for a long time, and it's more likely I'm seeing an old version of crystal reports the the new system doesn't know how to use but the older version on windows 2000 works just fine. Again, I know nothing so feel free to contradict that if you have a fresh insight. Thanks in advance, and wish me luck posting a question to any discussion board on a Friday evening

Accepted Solutions (0)

Answers (8)

Answers (8)

Former Member
0 Kudos

Post Author: f'lar

CA Forum: Crystal Reports

It's been a week. Bump.

Former Member
0 Kudos

Post Author: f'lar

CA Forum: Crystal Reports

Anyone?

Former Member
0 Kudos

Post Author: f'lar

CA Forum: Crystal Reports

I tried tackling this from a different angle, and added the following code just above the r.Export(False) line:r.FormulaFields.GetItemByName("OrganizationName").Text = "{##TableNameHidden##.OrganizationID};"For i As Integer = r.FormulaFields.Count - 1 To 1 Step -1 Dim formula As CRAXDRT.FormulaFieldDefinition = r.FormulaFields(i) Dim Okay As Boolean Dim Err As String = "" formula.Check(Okay, Err) If Not Okay Then Throw New Exception("Invalid formula")Next i "OrganizationName" was derived by trial and error varying the loop underneath it, and the text property I assign there is based in part on the original formula (removed the function call, but kept the argument) . At this point, all formulas should be valid, unless I'm missing something about descending into sub reports (I looked but didn't see how to do that). The "Invalid Formula" exception will not be thrown now, but I still get the "The remaining text does not appear to be part of the formula." error. How can I place a valid value there, or make it re-calculate the formula?

Former Member
0 Kudos

Post Author: f'lar

CA Forum: Crystal Reports

I've been checking around google, trying some things, and I think I've made some progress. I did some investigating on the win2000 machine's file system. I'm pretty sure now these are version 8.5 files. Also, I was able to grab some .dlls from the machine (notably crxadrt.dll) and register them locally. Adding a reference to that dll in a visual studio project and I was able to build this code:Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim a As New CRAXDRT.Application Dim r As CRAXDRT.Report = a.OpenReport("C:\a.rpt")' r.MorePrintEngineErrorMessages = False r.EnableParameterPrompting = False' r.ExportOptions.FormatType = CRAXDRT.CRExportFormatType.crEFTText '8 'r.ExportOptions.FormatType = CRAXDRT.CRExportFormatType.crEFTPortableDocFormat '31' r.ExportOptions.DestinationType = CRAXDRT.CRExportDestinationType.crEDTDiskFile ' 1 r.ExportOptions.DiskFileName = "C:\a.txt" 'r.FormulaSyntax = CRAXDRT.CRFormulaSyntax.crBasicSyntaxFormula r.FormulaSyntax = CRAXDRT.CRFormulaSyntax.crCrystalSyntaxFormula' r.Export(False)End SubIn that code, "a.rpt" is an actual file I've copied locally and renamed to avoid having to type the long name so much. You can also see that I've been playing with some of the options to see if anything helps. It runs all the way up the last line ( r.Export(False) ) at which point I get a "COMException was unhandled" exception with this error message:"The remaining text does not appear to be part of the formula."The good news is that it runs nice and quick with no requests to access a database and without my bastardized template from the earlier scenario. Also, it's consistent with the last piece of advice I got (a function referring to a missing dll). So my question still stands- how do I find this mystery dll? I've been looking around the windows 2000 machine and I can't find anything obvious.

Former Member
0 Kudos

Post Author: f'lar

CA Forum: Crystal Reports

Is there a naming convention the developer would have followed or a standard location where the files are placed that I can use to help find this file?

Former Member
0 Kudos

Post Author: IdoMillet

CA Forum: Crystal Reports

That formula probably uses a function from a UFL (User Function Library). Since your machine doesn't have the UFL dll, the formula fails to be evaluated on your machine. Solution: get the dll...

Former Member
0 Kudos

Post Author: f'lar

CA Forum: Crystal Reports

We get a new file every day, and the file is always a different size. I'm pretty sure the data is included in the file.

Former Member
0 Kudos

Post Author: IdoMillet

CA Forum: Crystal Reports

Are you 100% sure the rpt file was saved with data?