Export History

4 posts / 0 new
Last post
Robert van den ...
Offline
Joined: 08/08/2018 - 07:37
Export History

Is it possible to export the history to a txt file from the IDEA script?

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Robert, there is no way that I know of to do it directly.  You could access the project overview database and recreate the history from that but it is not easy to do.

efriedrich
Offline
Joined: 06/17/2019 - 04:01

Hi Robert,
I found a snippet in the forums and modified it. Try this:

Open the project in IDEA and run the script. Choose 'projectOverview.sdf' from the project folder. You should find 'ProjectHistory.txt' in your project folder that contains the whole project history (plain text only).


Option Explicit
'create a type to hold the entire overview table from the database
Type project
TaskName As String
DateTime As String
UserName As String
IDEAScript As String
HistoryLog As String
DataBaseGUID As String
TaskGUID As String
RecordGUID As String
AllRecordsUsed As String
TaskType As String
TaskStream As String
Filename As String
SubFolder As String
Unsupported As String
ProjectName As String
Deleted As String
End Type
Sub Main
Dim objConn As Object
Dim connStr As String
Dim rs As Object
Dim i As Integer
Dim ProjectInfo() As project
Dim bFirstTime As Boolean
bFirstTime = True
ReDim ProjectInfo(0)
i = 0
Dim filename As String
Dim obj As Object
Dim fs As Object
Dim a As Object
Dim sProject As String
sProject = Client.WorkingDirectory()
Set obj = Client.CommonDialogs
MsgBox "choose ProjectOverview.sdf"
filename = obj.FileOpen("","","ProjectOverview(*.sdf)|*.sdf||")
If filename = "" Then
MsgBox "aborted!"
Else
MsgBox "history export started"
End If
Set obj = Nothing
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(sProject & "ProjectHistory.txt", True)
'create the connection object to the database
Set objConn = CreateObject("ADODB.Connection")
'create the connection string. The Data source has to point to the sdf file of the project you want to extract the info
Projects\EBP v10.2\ProjectOverview.sdf;"
connStr = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=" & filename
'connect to the database
objConn.open connStr
'use SQL to access the information. In this instance all the fields are accessed, I used the field names instead of using SELECT *.*
Set rs = objConn.execute("SELECT TaskName, DateTime, UserName, IDEAScript, HistoryLog, DatabaseGUID, TaskGUID, RecordGUID, AllRecordsUsed, TaskType, TaskStream, Filename, SubFolder, Unsupported, ProjectName, Deleted FROM Overview")'
'loop through the table
Do While Not rs.EOF
'increment the array to hold the informaiton
If Not bFirstTime Then
ReDim preserve ProjectInfo(UBound(ProjectInfo) + 1)
End If
'populate the array with the information.
ProjectInfo(i).TaskName = rs.Fields("TaskName")
ProjectInfo(i).DateTime = rs.Fields("DateTime")
ProjectInfo(i).UserName = rs.Fields("UserName")
ProjectInfo(i).IDEAScript = rs.Fields("IDEAScript")
ProjectInfo(i).HistoryLog = rs.Fields("HistoryLog")
ProjectInfo(i).DataBaseGUID = rs.Fields("DatabaseGUID")
ProjectInfo(i).TaskGUID = rs.Fields("TaskGUID")
ProjectInfo(i).RecordGUID = rs.Fields("RecordGUID")
ProjectInfo(i).AllRecordsUsed = rs.Fields("AllRecordsUsed")
ProjectInfo(i).TaskType = rs.Fields("TaskType")
ProjectInfo(i).TaskStream = rs.Fields("TaskStream")
ProjectInfo(i).Filename = rs.Fields("Filename")
ProjectInfo(i).SubFolder = rs.Fields("SubFolder")
ProjectInfo(i).Unsupported = rs.Fields("Unsupported")
ProjectInfo(i).ProjectName = rs.Fields("ProjectName")
ProjectInfo(i).Deleted = rs.Fields("Deleted")
a.WriteLine(ProjectInfo(i).HistoryLog)
i = i + 1
'move to the next record.
rs.MoveNext
Loop
Set rs = Nothing
Set objConn = Nothing
a.Close
Set a = Nothing
Set fs = Nothing
MsgBox "Finished!"
End Sub

efriedrich
Offline
Joined: 06/17/2019 - 04:01

Hi Robert,
I found a snippet in the forums and modified it. Try this:

Open the project in IDEA and run the script. Choose 'projectOverview.sdf' from the project folder. You should find 'ProjectHistory.txt' in your project folder that contains the whole project history (plain text only).

Option Explicit
'create a type to hold the entire overview table from the database
Type project
TaskName As String
DateTime As String
UserName As String
IDEAScript As String
HistoryLog As String
DataBaseGUID As String
TaskGUID As String
RecordGUID As String
AllRecordsUsed As String
TaskType As String
TaskStream As String
Filename As String
SubFolder As String
Unsupported As String
ProjectName As String
Deleted As String
End Type
Sub Main
Dim objConn As Object
Dim connStr As String
Dim rs As Object
Dim i As Integer
Dim ProjectInfo() As project
Dim bFirstTime As Boolean
bFirstTime = True
ReDim ProjectInfo(0)
i = 0
Dim filename As String
Dim obj As Object
Dim fs As Object
Dim a As Object
Dim sProject As String
sProject = Client.WorkingDirectory()
Set obj = Client.CommonDialogs
MsgBox "choose ProjectOverview.sdf"
filename = obj.FileOpen("","","ProjectOverview(*.sdf)|*.sdf||")
If filename = "" Then
MsgBox "aborted!"
Else
MsgBox "history export started"
End If
Set obj = Nothing
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(sProject & "ProjectHistory.txt", True)
'create the connection object to the database
Set objConn = CreateObject("ADODB.Connection")
'create the connection string. The Data source has to point to the sdf file of the project you want to extract the info
Projects\EBP v10.2\ProjectOverview.sdf;"
connStr = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=" & filename
'connect to the database
objConn.open connStr
'use SQL to access the information. In this instance all the fields are accessed, I used the field names instead of using SELECT *.*
Set rs = objConn.execute("SELECT TaskName, DateTime, UserName, IDEAScript, HistoryLog, DatabaseGUID, TaskGUID, RecordGUID, AllRecordsUsed, TaskType, TaskStream, Filename, SubFolder, Unsupported, ProjectName, Deleted FROM Overview")'
'loop through the table
Do While Not rs.EOF
'increment the array to hold the informaiton
If Not bFirstTime Then
ReDim preserve ProjectInfo(UBound(ProjectInfo) + 1)
End If
'populate the array with the information.
ProjectInfo(i).TaskName = rs.Fields("TaskName")
ProjectInfo(i).DateTime = rs.Fields("DateTime")
ProjectInfo(i).UserName = rs.Fields("UserName")
ProjectInfo(i).IDEAScript = rs.Fields("IDEAScript")
ProjectInfo(i).HistoryLog = rs.Fields("HistoryLog")
ProjectInfo(i).DataBaseGUID = rs.Fields("DatabaseGUID")
ProjectInfo(i).TaskGUID = rs.Fields("TaskGUID")
ProjectInfo(i).RecordGUID = rs.Fields("RecordGUID")
ProjectInfo(i).AllRecordsUsed = rs.Fields("AllRecordsUsed")
ProjectInfo(i).TaskType = rs.Fields("TaskType")
ProjectInfo(i).TaskStream = rs.Fields("TaskStream")
ProjectInfo(i).Filename = rs.Fields("Filename")
ProjectInfo(i).SubFolder = rs.Fields("SubFolder")
ProjectInfo(i).Unsupported = rs.Fields("Unsupported")
ProjectInfo(i).ProjectName = rs.Fields("ProjectName")
ProjectInfo(i).Deleted = rs.Fields("Deleted")
a.WriteLine(ProjectInfo(i).HistoryLog)
i = i + 1
'move to the next record.
rs.MoveNext
Loop
Set rs = Nothing
Set objConn = Nothing
a.Close
Set a = Nothing
Set fs = Nothing
MsgBox "Finished!"
End Sub