cancel
Showing results for 
Search instead for 
Did you mean: 

Scripts return system epoch date from repository

Former Member
0 Kudos

Whenever I include CreationDateInRepository or ModificationDateInRepository in a VB script, say to return these dates for a repository model, the result is always the system epoch date (12/31/1969).

I can look at the dates in the UI and they are correct there. Likewise, a query against the repository DB (we are using Oracle) returns the correct dates.

VBScript, however, returns 12/31/1969.

Is there a bug in the scripting engine or a workaround for this situation?

SAP PowerDesigner 16.5 SP04

Version 16.5.4.0 (4521)

Oracle 11g

Client running on Windows 7

(This is a banking environment, so none of the above can be changed)

On 2/10/2016, Phillip Lam responded to a similar issue with:

"Sounds like a bug.

When you see system epoch date 12/31/1969 or 1/1/1970, it means the file never gets update

after it has been checked in. Somehow repository API never go to find version comment if the

the file has epoch date stamp.

If you check out a file, modify it and check in again, you'll see correct date and version comment

from the output."

Yes, we can see the dates and comments in the UI and in queries, proving that the DB is getting updated, but VBScript returns epoch date.

In addition, Author and Version comments, although present in the DB and visible in the UI, are hit and miss with VBScript.

Management is getting concerned about the accuracy of the contents of the information being reflected by PowerDesigner.

Accepted Solutions (0)

Answers (3)

Answers (3)

GeorgeMcGeachie
Active Contributor
0 Kudos

"Management is getting concerned about the accuracy of the contents of the information being reflected by PowerDesigner."

Hello Dan,

This may or may not reassure you . I know one of the major competitors of PD has a serious problem with scripts returning invalid metadata from models, but I think this is the first case I've heard of for PD. In the other tool, source-to-target mappings are different when you run a script compared to the GUI, which is a serious issue for my client. As they're not running a repository, they can't access the metadata any other way, resulting in manual work-arounds.

George

former_member200945
Contributor
0 Kudos

This is a known issue. We have bug report for it.

Former Member
0 Kudos

Is there an expected fix date for this? Is it fixed in 16.6?

former_member200945
Contributor
0 Kudos

The same problem occurs in 16.6.

We don't have fix date for this.

Former Member
0 Kudos

We faced same issue already in PowerDesigner 15.3. What we noticed is that the CreationDateInRepository and ModificationDateInRepository values  were correct for the models which were exrtracted in the workspace or for which the repository Properties window had been previously displayed (in the same PowerDesigner session).

So, we have developed a small script that was browsing all the repository, extracting in memory one model after the other and then writing the CreationDateInRepository and ModificationDateInRepository in a flat file.

We had 665 models (PDM and CDM) in our repository, and I had to do this in 2 runs (the 500 first models and then the remaining). But each run took less than 10 minutes.

So in the above given script, I assume that maybe onlyputting the ExtractToFile line before the display of the CreationDateInRepository property would be sufficient to get the correct dates :

         If subObject.IsKindOf(PdRMG.Cls_RepositoryDocument) or subObject.IsKindOf(PdRMG.Cls_RepositoryModel) then

          ' First extract the model or document

            subObject.ExtractToFile subObject.ExtractionName, 1

           ' then display the CreationDateInRepository property

            output "Extracting " & subObject.name & " Date " & subObject.CreationDateInRepository

         end if

Please see below an extract of our script which is only doing a "dummy" extract of the model  :

If subObject.IsKindOf(PdRMG.Cls_RepositoryDocument) or subObject.IsKindOf(PdRMG.Cls_RepositoryModel) then

     'Extract the model in memory

     subObject.ExtractToFile "", 1

     if subobject.className = "Conceptual Data Model" then

          fileExtension = "CDM"

     elseIf subobject.className = "Physical Data Model" then

          fileExtension = "PDM"

     else

          fileExtension = "OTHER"

     end if

     'Write the details in the file

     objOutFile.Write(folder.name & ";" & subObject.name &  ";" & fileExtension & ";" & subObject.CreationDateInRepository & ";" & subObject.ModificationDateInRepository&vbCrLf)

     'Close the model by closing the workspace

     Set workspace = ActiveWorkspace

     workspace.close

     set workspace = nothing

end if

Knowing that the creation of the file is done in the following way :

Set objFS = CreateObject("Scripting.FileSystemObject")

strTemp = "C:\temp.txt"

Set objOutFile = objFS.CreateTextFile(strTemp,True)

I hope this works as well in the most recent versions 16.x !

Former Member
0 Kudos

More information.

Code snippet from the script:

  ' Recursive call on sub folders

   Dim subObject

   For Each subObject in folder.ChildObjects

      ' recurse or extract repository sub-package

      If subObject.IsKindOf(PdRMG.Cls_RepositoryFolder) then

         ScanRepository subObject

      else

         If subObject.IsKindOf(PdRMG.Cls_RepositoryDocument) or subObject.IsKindOf(PdRMG.Cls_RepositoryModel) then

            output "Extracting " & subObject.name & " Date " & subObject.CreationDateInRepository

            'subObject.ExtractToFile subObject.ExtractionName, 1

         end if

      End If

   Next

Ran the script this morning. Here are part of the results:

Scanning the folder Enventory

Extracting ENVentory CDM Date 12/31/1969 7:00:00 PM

Extracting ENVentory LDM Date 12/31/1969 7:00:00 PM

Extracting ENVentory PDM Date 12/31/1969 7:00:00 PM

Extracting Enventory Date 12/31/1969 7:00:00 PM

Note that the models and the folder all have the system epoch date as Creation Date

Checked out ENVentory LDM, Moved an entity in the diagram, checked it in.

Reran the script. Results:

Scanning the folder Enventory

Extracting ENVentory CDM Date 12/31/1969 7:00:00 PM

Extracting ENVentory LDM Date 5/19/2016 2:58:53 PM  

Extracting ENVentory PDM Date 12/31/1969 7:00:00 PM 

Extracting Enventory Date 2/5/2016 11:11:18 PM 

Note that the Creation Date for the LDM has been changed to today (the date MODIFIED)

Also, the Creation Date for the folder is now returned.

Shut down PowerDesigner, Started back up and ran the script. The results:

Scanning the folder Enventory

Extracting ENVentory LDM Date 12/31/1969 7:00:00 PM  

Extracting ENVentory CDM Date 12/31/1969 7:00:00 PM  

Extracting ENVentory PDM Date 12/31/1969 7:00:00 PM  

Extracting Enventory Date 12/31/1969 7:00:00 PM  

Back to epoch dates!

Could it be that the scripting engine is not really getting the dates from the repository?

The CDM and PDM are not on my hard drive. I only checked out the LDM.

So the question now is this: How to get the PD scripting engine to actually retrieve ALL the requested data from the repository?

Former Member
0 Kudos

In response to:

Checked out ENVentory LDM, Moved an entity in the diagram, checked it in.

Reran the script. Results:

Scanning the folder Enventory

Extracting ENVentory CDM Date 12/31/1969 7:00:00 PM

Extracting ENVentory LDM Date 5/19/2016 2:58:53 PM

Extracting ENVentory PDM Date 12/31/1969 7:00:00 PM

Extracting Enventory Date 2/5/2016 11:11:18 PM

Note that the Creation Date for the LDM has been changed to today (the date MODIFIED)

Also, the Creation Date for the folder is now returned.

My experience has been that the creation date displayed, is the creation date for the VERSION, not the creation date for the MODEL.  Which is why it is the same as the modified date. 

I was creating an excel model inventory,

   WriteCell objS1, intRC, "C", subObject.GetRepositoryAttribute("CreationDateInRepository")      

     '* RepositoryBaseObject property VERSION creation date

   WriteCell objS1, intRC, "D", subObject.GetRepositoryAttribute("ModificationDateInRepository")

     '* RepositoryBaseObject property VERSION modification date

and was able to get the non-epoch date using the GetRepositoryAttribute method.

I'm looking for a way to circle around to version 1 to get the true creation date for the model.

Jane