Parcourir la source

Neue Idee für Portal-Aktualisierung.

- Bei Reisacher getestet und leider weiterhin Problem mit Anmeldung
Global Cube il y a 2 ans
Parent
commit
c45996ad8c
3 fichiers modifiés avec 95 ajouts et 61 suppressions
  1. 93 61
      gctools/VBS/publish-reports.mac
  2. BIN
      gctools/VBS/publish-reports.mcx
  3. 2 0
      gctools/config/Reports.csv

+ 93 - 61
gctools/VBS/publish-reports.mac

@@ -1,71 +1,103 @@
-Dim objApp As Object
 Dim objRep As Object
-Dim folder as String
+Dim objPDF as Object
+
+Dim configFile as String
 Dim publish As String
+
+Dim Debug As Integer
+
+Dim reportFile As String
 Dim exportFormat As String
+Dim layers As String
+
+Declare Sub ReportExport   
+
 
 Sub Main ()
+   Debug = 1
    Rem On Error Resume Next
-   Set objApp = CreateObject("CognosPowerPlay.Application")
-   rem folder = "C:\GAPS\Portal\System\Report"
-   rem exportFormat = "pdf"
-   rem publish = "C:\GAPS\Portal\daten"
+   If Debug = 1 Then
+      configFile = "C:\Projekte\Python\gctools\config\Reports.csv"
+      publish = "C:\GAPS\Portal\daten"
+   Else
+      configFile = GetField(Command, 1, ",")
+      publish = GetField(Command, 2, ",")
+   End If
+
    
-   folder = GetField(Command, 1, ",")
-   exportFormat = GetField(Command, 2, ",")
-   publish = GetField(Command, 3, ",")
+   Dim lineStr As String
+   Dim reportFile As String
+   Dim exportFormat As String
+   Dim layers As String
+      
+   Open configFile For Input As #1
+      Do While Not EOF(1)
+         Line Input #1, lineStr 
+         reportFile = GetField(lineStr, 1, ";")
+         exportFormat = GetField(lineStr, 2, ";")
+         layers = GetField(lineStr, 3, ";")
+         Print reportFile, exportFormat
+         Call ReportExport
+
+      Loop
+   Close #1
+End Sub
 
-   Dim filename as String
+
+Sub ReportExport   
+   ' reportFile, exportFormat, layers as Parameters
    Dim exportFile as String
-   Dim objPDF as Object
-   
-   filename = Dir(folder + "\")
-
-   Do While filename <> ""
-      If LCase(Right(filename, 4)) = ".ppr" Or LCase(Right(filename, 4)) = ".ppx" Then
-         Set objRep = CreateObject("CognosPowerPlay.Report")
-         objRep.Open(folder + "\" + filename)
-         exportFile = publish + "\" + Left(filename, Len(filename) -4)
-         Select Case exportFormat
-            Case "pdf"
-               
-               Set objPDF = objRep.PDFFile(exportFile + "_0.pdf", True)
-               With objPDF
-                  .SaveEntireReport = True
-                  .AxisOnAllPages = True
-                  .ChartTitleOnAllPages = False
-                  .IncludeLegend = False
-               End With
-               objPDF.Save
-
-               For i = 1 to objRep.Layers.Count
-                  Set objPDF = objRep.PDFFile(exportFile + "_" + i + ".pdf", True)
-                  With objPDF
-                     .SetListOfLayersToSave objRep.Layers.Subset(i, i)
-                     .SetListOfRowsToSave objRep.Rows
-                     .SaveEntireReport = False
-                     .SaveAllCharts = False           
-                     .AxisOnAllPages = True
-                     .ChartTitleOnAllPages = True
-                     .IncludeLegend = True
-                  End With
-                  objPDF.Save
-               Next
-
-            Case "asc"
-               objRep.SaveAs exportFile, 3
-            Case "xls"
-               objRep.SaveAs exportFile, 4
-            Case "ppx"
-               objRep.SaveAs exportFile, 5
-            Case Else
-               objRep.Publish publish, False, True, True    
-         End Select
-         objRep.Close
-      End if
-
-
-      filename = Dir
-   Loop
-   objApp.Quit
+   Dim layer as String
+   Dim layerInt as Integer
+
+   Set objRep = CreateObject("CognosPowerPlay.Report")
+   objRep.Open(folder + "\" + reportFile)
+   exportFile = publish + "\" + Left(reportFile, Len(reportFile) -4)
+   Select Case exportFormat
+      Case "pdf"         
+         Set objPDF = objRep.PDFFile(exportFile + "_0.pdf", True)
+         With objPDF
+            .SaveEntireReport = True
+            .AxisOnAllPages = True
+            .ChartTitleOnAllPages = False
+            .IncludeLegend = False
+         End With
+         objPDF.Save
+
+         For i = 1 To 255
+            layer = GetField(layers, i, ",")
+            If layer = "" Then
+               Exit For
+            End If
+            layerInt = Val(layer)
+            If layerInt > objRep.Layers.Count Then
+               Exit For
+            End If
+
+            Set objPDF = objRep.PDFFile(exportFile + "_" + layer + ".pdf", True)
+            With objPDF
+               .SetListOfLayersToSave objRep.Layers.Subset(layerInt, layerInt)
+               .SetListOfRowsToSave objRep.Rows
+               .SaveEntireReport = False
+               .SaveAllCharts = False           
+               .AxisOnAllPages = True
+               .ChartTitleOnAllPages = True
+               .IncludeLegend = True
+            End With
+            objPDF.Save
+         Next
+
+      Case "asc"
+         objRep.SaveAs exportFile, 3
+      Case "xls"
+         objRep.SaveAs exportFile, 4
+      Case "ppx"
+         objRep.SaveAs exportFile, 5
+      Case Else
+         objRep.Publish publish, False, True, True    
+   End Select
+   objRep.Close
+   Set objRep = Nothing
+
 End Sub
+

BIN
gctools/VBS/publish-reports.mcx


+ 2 - 0
gctools/config/Reports.csv

@@ -0,0 +1,2 @@
+Test;pdf;1,2,3,4
+Test2;xls;2,3,4