cancel
Showing results for 
Search instead for 
Did you mean: 

File Header - PDM Script

Former Member
0 Kudos

Hello. I would like to set some customizations in Oracle script file header. I was able to find how to set the date and the script name with variables ( %DATE% and %NAMESCRIPT% respectively) but there are other informations I don't know how to do. Below, follow a sample header:


/* Script generated on: %DATE% by the user %USER% */  the variable %USER% didn't display any output

/* Script name: %NAMESCRIPT% */

/* Label: ????? */                 Here, I want to put information about which configuration label is linked to this document version , if exists.

/* Model/ Version: ??????? */ Here, I want to put what the PDM name and the repositoty version corresponding to script

Regards, Jan.

Accepted Solutions (1)

Accepted Solutions (1)

former_member185317
Active Participant
0 Kudos

Hi Jan,

Instead of %USER%, try %AUTHOR% which will give you the author of the model from the Version Info or the author from the Model Properties box.

For model version from the Repository use %ExtractionVersion%.

For model branch name use %ExtractionBranchName%.

For model version and branch all together, use %ExtractionFullVersion%

As for the label information where you want to gather the Configuration that it exist in, you may need to pre-run a VBScript like mentioned in earlier post and place that content into a user defined extended attribute (i.e. label) and then use that variable within your DBMS Definition File. the table it would come from is PMCNFG within the Repository. You can find the entire metamodel for the Repository in the \\PowerDesigner 16\Examples\Repository Metamodel.pdm directory.

This information cam from the Help menu, Metamodel Objects Help. I then looked under Base Model to find the properties available. This is not in the customizing DBMS Definition because these are not common properties that affect DDL generation.

HTH,

-Matt C.

Former Member
0 Kudos

Thank you Matt. You informations were very useful. As for the model version and the model name I got by using VBscript and it worked well. I was not able to find these globals variables.

Great this Repository MetamodelI I didnt know it. I have found it in directory you mentioned. There exist the tables PMCNFG and PMOBJT are ones I want to gather informations. How could I extract the datas from admin tables by VBscript? Could you give me an example?

Thank you very much.

former_member185317
Active Participant
0 Kudos

The global variables are part of the PowerDesigner Metamodel which you can find under the Help menu, Metamodel Object Help. Then search on a model and check the available attributes for that object.

As for your second question, you will ne to follow Dirk's example and to include SQL script w/in you VBScript then you will have to build a complex join between the PMOBJT, PMOCNF and PMCNFG joining on OBJT and CNFG. You can find this in the metamodel pdm I referenced below in the Object Management Package, version diagram.

HTH,

-Matt C.

former_member185199
Contributor
0 Kudos

Morning Matt,

wouldn´t it be time for a little bit more advanced GUI/API/(VBS)PD-Objecst regarding the Repository?

This is not the first Request i´ve read so far, that people need information out of the rep which the can get only by complex queries on the backend.

Some examples are:

And maybee more i couldn´t locate so fast

Regards

dj

former_member185317
Active Participant
0 Kudos

These are all good ideas. I know the first one, PowerDesigner 16.5 Search on keyword is already available within the PowerDesigner Portal.

Cheers,

-Matt C.

Answers (4)

Answers (4)

Former Member
0 Kudos

Unluckily, In my company it will not be possible to connect in the repository by ODBC.

I would like to label the script generated with a tag that I could find it easily.

We have a version control system here and it stores all of projetct artifacts in development or in production. Furthermore we have the PowerDesigner to manage all models in the repository.

we intend to link informations between two repositories. The alternative was tag the script with some informations.

Other question: Could I put a string comprising the repository file location in the PDM script generated?


Thank you for you great help.

former_member185199
Contributor
0 Kudos

You should think about an enhancement (hope i spelled that right)  request?

I unfortunally cant help you further

Former Member
0 Kudos

Please, Someone Could tell me how I can extract datas of tables PMCNFG and PMOBJT by VBscript? I haven't found so far.

former_member185199
Contributor
0 Kudos

you cant by normal objects of Powerdesigner

you need to use an odbc connection and select it from the tables

one example:

[RESOLVED] ODBC DSN with vbscript and some simple questions-VBForums

former_member185199
Contributor
0 Kudos

Hi Jan,

is there anything unanswered ?

otherwise you should mark the question as answered so everyone can see this immediately.

all valid variables in a DBMS extension you can find in the help:

Customizing and Extending PowerDesigner > DBMS Definition Files > PDM Variables and Macros

dj

former_member185199
Contributor
0 Kudos

Hello Jan

the Variable %USER% doesnt display any Output because its related to the users modeled in your Model, for example to create a user from the model the following code is used:

[.O:[create user %USER%[ %Definition%]][create schema authorization %USER% %SCHEMADEFN%]]

in the scope you are trying to use it its not defined and not holding the information of the PowerDesigner user

But  as in VBS the variable USERNAME does hold the PD user you can use .vbscript to get this information:

This script in the headerscetion of the dbms-definition:

/* THIS IS A TEST FOR USER

.vbscript()

ScriptResult = UserName

.endvbscript

, hopefully its succesful */

Outputs:

/* THIS IS A TEST FOR USER HTE4974, HOPEFULLY ITS SUCCESFUL */

the same way you can get name and repository version:

.vbscript()

ScriptResult = activemodel.name &"|Version:" & activemodel.ExtractionVersion & "|"

.endvbscript

i dont understand what is a configuration label, if its a user defined information put it in an xtended attribute

regards

dj

Message was edited by: dirk jaeckel

Former Member
0 Kudos

Thank you dirk. It was exactly I wanted to do about the username.

I think I wasn't clear enough. Configurations are for grouping Document versions, something like to label documents in the repository. 

Help in "Grouping Document Versions in a Configuration" (Core Features Guide > Storing, Sharing, and Reporting on Models > The Repository ).

We intend to have a Configuration management for all aterfacts created on the projects.

Before the scripts do go to production we will label all project documents and we need that this labels are in Oracle file header.

Regards, Jan.

former_member185199
Contributor
0 Kudos

hi

you might try to play around with these:

msgbox activemodel.RepositoryInformation

msgbox activemodel.findinrepository().comment 

msgbox activemodel.findinrepository().connection

my admin doesn´t give me the right to create Configurations in the repo so i cant evaluate further

but from the metamodel point of view it looks like the Configurations are not stored on the model directly, hence that there is a collection of Configurations somewhere wich have collections of models.

dj