Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Crystal Reports Learning Curve
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Crystal Reports
Divers
Thread ID:
00694901
Message ID:
00771072
Vues:
55
I just tested this code and it works:
ocr = createobject("crystalruntime.application")
orpt = ocr.openreport("c:\cr\myreport.rpt")
odb = orpt.database
otables = odb.tables
otable = odb.tables.item(1)
otable.SetTableLocation("C:\temp\goober.dbf", "goober", "")
orpt.discardsaveddata()
orpt.readrecords()
orpt.printout()
>Craig,
>
>I'v determined that the issue is that the reports are created with data in
>one location, then run againt temp tables with different names in another
>location.
>
>I created this function:
>
>It receives a 2 dimensional array with:
>[1] Full path & name of table
>[2] Alias
>
>
>To test, I create a copy of the live table in a test location
>and fill the array with that info.
>
>If the name of the table matches what it is in the report in design time,
>all works fine, but if the name of the table is different, I get a blank
>report.
>
>
>
>FUNCTION SetTableLocations
>PARAMETERS aTables
>
>oTables = ._oReport.Database.Tables
>
>** Loop once for each array element
>FOR nTable1 = 1 TO ALEN(aTables, 1)
>
>  ** Extract the table name and alias from the array
>  cTable = aTables[nTable1, 1]
>  cAlias = LOWER(ALLTRIM(aTables[nTable1, 2]))
>
>  ** Loop once for each table in the collection
>  FOR nTable2 = 1 TO oTables.Count
>
>    ** Extract the table from the collection, and get the alias name
>    oTable = oTables.Item(nTable2)
>    cRptAlias = LOWER(ALLTRIM(oTable.Name))
>
>    ** If the report alias matches the array alias...
>    IF cRptAlias = cAlias
>      ** Change the data location
>      oTable.Location = cTable
>    ENDIF
>
>  ENDFOR
>
> ENDFOR
>
>
>
>I also tried this, from your website - no effect. I still get a
>blank report.
>
>
>oRpt = ._oReport
>oDB = oRpt.Database
>ocDBT = oDB.Tables()
>
>oDBT = ocDBT.Item(1)
>oDBT.Location = aTables[1, 1]
>			
>oDBT = ocDBT.Item(2)
>oDBT.Location = aTables[2, 1]
>
>
>After this code runs, the Location value is unchanged.
>
>I could really use your help on this. Many Thanks
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform