Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CR 9 TSLV and Table '' problem
Message
General information
Forum:
Visual FoxPro
Category:
Crystal Reports
Miscellaneous
Thread ID:
00826456
Message ID:
00827185
Views:
12
In playing, I found the solution to this problem. We as VFP developers sometimes don't think that CASE matters with variable names. Well, in this case it does. (also VFP collection keys)

Changing the the following line in the SetData method:
*loTable.SetTableLocation("C:\Work\Crystal9Test\edprna.dbf", cName, cBuffer)
* TO
loTable.SetTableLocation("C:\Work\Crystal9Test\edprna.dbf", LOWER(cName), cBuffer)
Hope this helps someone down the line.
Tracy

>We are having a problem with Crystal Reports 9 on every machine we have tried this on. To verify this was not a problem with the machines we also tested this on a clean install of W2K SP 4, VFP8, and Crystal Reports 9. Is there something we are missing in this to get it working? From what we have found online, in the help, and in Books available, we’ve not missed anything.
>
>We also tried this with the latest service patch available from Crystal, and we still don’t get the expected results. We are stumped, any help you might have would be greatly appreciated.
>
>TIA,
>
>
>PUBLIC oform1
>
>oform1=NEWOBJECT("form1")
>oform1.Show
>RETURN
>
>*************************************************
>*-- Form:         form1 (c:\work\crystal9test\crystal9test.scx)
>*-- ParentClass:  form
>*-- BaseClass:    form
>*-- Time Stamp:   09/05/03 10:38:12 AM
>*
>DEFINE CLASS form1 AS form
>
>	Top = 0
>	Left = 0
>	Height = 400
>	Width = 632
>	DoCreate = .T.
>	Caption = "Form1"
>	Name = "Form1"
>	ocr = .F.
>	ocrreport = .F.
>
>	PROCEDURE Init
>		*-- There are 3 different RPT files
>		*-- EDPRNA  - Original report file created in CR8
>		*-- EDPRNA1 - Reports opened and saved IN CR9
>		*-- EDPRNA2 - Brand new report created completly in CR9
>
>		*-- Test CR 8 This works
>		*THIS.oCR = CREATEOBJECT("CrystalRuntime.Application.8")
>		*THIS.oCRReport = THIS.oCR.OpenReport("C:\WORK\CRYSTAL9TEST\EDPRNA.RPT")
>
>		*-- Test CR 9 does not work
>		THIS.oCR = CREATEOBJECT("CrystalRuntime.Application.9")
>
>		*-- First test existing report created in CR8
>		*-- This gives a TSLV record not found
>		THIS.oCRReport = THIS.oCR.OpenReport("C:\WORK\CRYSTAL9TEST\EDPRNA.RPT")
>
>		*-- Test report opened and saved in CR9
>		*-- This gives a table '' not found
>		*THIS.oCRReport = THIS.oCR.OpenReport("C:\WORK\CRYSTAL9TEST\EDPRNA1.RPT")
>
>		*-- Test report created in CR9
>		*-- this also gives a table '' not found.
>		*THIS.oCRReport = THIS.oCR.OpenReport("C:\WORK\CRYSTAL9TEST\EDPRNA2.RPT")
>
>		*-- SetData sets the data location of the report
>		*-- If you comment this out it works but displays the data
>		*-- in the location where the report was created.
>		THIS.SetData()
>
>		THIS.oCRReport.DiscardSavedData()
>		THIS.AddObject("oCRV", "oleControl", "crViewer9.crViewer")
>
>		WITH THIS.oCRV
>		   *-- Set viewer properties
>		   .Top = 1
>		   .Left = 1
>		   .Width = THIS.Width - 2
>		   .Height = THIS.Height - 2
>		   .ReportSource = THIS.oCRReport
>		   .ViewReport
>		ENDWITH
>	ENDPROC
>
>   *-- Places data on the OLE drag and drop DataObject.
>   PROCEDURE setdata
>      LOCAL loDB, loDT, loTable, cName, cBuffer, lnCRVer, loConnection, cOut, loNameId
>
>      * SET STEP ON
>
>      loDB = THIS.oCRReport.Database()
>      loDT = loDB.Tables()
>      loTable = loDt.Item(1)
>
>      *-- Get table name to make sure using the same exact casing that CR has for the name
>      cName = loTable.Name
>
>      *-- Tried setting the buffer string and leaving it blank both give the error message
>      *cBuffer = "PreQEServerType=PDBXBSE.DLL;;PreQEServerName=C:\work\Crystal9Test\edprna.dbf"
>      cBuffer = ""
>
>      *-- Tried to set the location directly and use the SetTableLocation both give error message
>      *loTable.Location = "C:\work\Crystal9Test\edprna.dbf"
>      loTable.SetTableLocation("C:\Work\Crystal9Test\edprna.dbf", cName, cBuffer)
>
>      *-- Won't work ConnectionBufferString is read only
>      *loTable.ConnectionBufferString = "PreQEServerType=PDBXBSE.DLL;;" ;
>            + "PreQEServerName=C:\work\Crystal9Test\edprna.dbf;;" ;
>            + "Data File=C:\work\Crystal9Test\edprna.dbf"
>
>      *-- Some differences between CR8 & CR9
>      *-- In CR8 the location proprty shows the whole path to the table. When you change
>      *-- it shows in the property. In CR9 the location property only shows the table alias.
>      *-- In this case EDPRNA. After setting it with either using location directly or the
>      *-- SetTableLocation method, it still shows the table alias. The ConnectBufferString
>      *-- property in CR8 is empty and does not change even after changing the location.
>      *-- In CR9 the ConnectBufferString has information in it. It shows the whole path to the table.
>      *-- The ConnectBufferString changes when you set the table using either method. In the
>      *-- report created in CR9 the only setting in the ConnectBufferString is the Data File
>      *-- section, the PreQEServerType and PreQEServerName parts were not there. Also after setting
>      *-- table location these sections were removed from the connection buffer string as well.
>
>      *-- CR8 Doesn't have a ConnectionProperties Collection
>      lnCrVer = THIS.oCr.GetVersion()
>      IF lnCRVer <> 2048  && 2048 is version 8
>         *-- get the connection information
>         loConnection = loTable.ConnectionProperties
>
>         *-- Also tried to set the connection information, but got the same error
>         *loConnection.Item("PreQeServerName").Value = "C:\work\Crystal9Test\edprna.dbf"
>         *loConnection.Item("Data File").Value = "C:\work\Crystal9Test\edprna.dbf"
>
>         cOut = ""
>         FOR EACH loNameId IN loConnection.NameIds
>            cOut = cOut + loNameId + " = " + loConnection.Item(loNameId).Value + CHR(10)
>         NEXT
>         =MESSAGEBOX(cOut)
>      ENDIF
>
>      *-- Also generates the error table '' is not found.
>      *loDB.Verify()
>   ENDPROC
>
>   PROCEDURE Error
>      LPARAMETERS nError, cMethod, nLine
>
>      LOCAL nArrLen, cErrorMessage
>
>      IF nError != 1440
>         nArrLen =AERROR(arrError)
>         cErrorMessage = ""
>         FOR nLoop = 1 TO nArrLen
>            cErrorMessage = cErrorMessage + arrError[nLoop,2] + CHR(10) + arrError[nLoop,3] +CHR(10)
>         NEXT
>
>         =MESSAGEBOX(TRANSFORM(nError)+CHR(10)+cMethod+CHR(10)+TRANSFORM(nLine)+CHR(10)+cErrorMessage)
>
>      ENDIF
>
>      RETURN
>
>   ENDPROC
>
>ENDDEFINE
>*
>*-- EndDefine: form1
>**************************************************
>
Tracy
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform