Author Topic: RunReport with PowerShell  (Read 3063 times)

Stasjah

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
RunReport with PowerShell
« on: October 21, 2024, 08:46:32 pm »
Hi,

So there is this server with PostgreSQL and Enterprise Architect 17 and Enterprise Architect 16 having a direct link.

The server has a task of creating documents at a timestamp with powershell.

$eaRep = new-object -ComObject "EA.Repository" -ErrorAction Stop
$eaRep.SuppressSecurityDialog = "True";
$eaRep.OpenFile2($model, $doc_user, $doc_pass);
$eaProject = $eaRep.GetProjectInterface();
$eaProject.RunReport("$master_doc_guid", "$template", "$output")

when running this the document comes out bad,
- Frontpage is gone
- Heading numbers are wrong ( 1.1 follows on 32)
- pages that should be at the front are somewhere in the middle or in the back

But when i run the .RunReport Commando with the same parameters within a EA instance Script window (javaScript) the document comes out just fine. (same user, same connection, same machine).

Any suggestions ?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: RunReport with PowerShell
« Reply #1 on: October 22, 2024, 01:43:17 am »
You need a user on the server to do that (aka a license). EA only offers it's API to an end-user with a license. And on a server you usually only have the databse knowing nothing about EA.

q.

Stasjah

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: RunReport with PowerShell
« Reply #2 on: October 23, 2024, 06:14:45 pm »
You need a user on the server to do that (aka a license). EA only offers it's API to an end-user with a license. And on a server you usually only have the databse knowing nothing about EA.

q.

Hi qwerty,

that doesnt make any sense. why whould it generate a document through powershell at all then ? it makes a document but it is a other output then when you do with from within EA. I give that instance a floating license it is the same wrong result.

I installed EA on the servers for testing purposes.

Stasjah

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: RunReport with PowerShell
« Reply #3 on: October 23, 2024, 07:42:56 pm »
Yes, I got the wrong idea about your issue. Sorry, no clue...

q.
« Last Edit: October 24, 2024, 02:07:28 am by qwerty »

ea0522

  • EA User
  • **
  • Posts: 134
  • Karma: +5/-0
    • View Profile
Re: RunReport with PowerShell
« Reply #4 on: October 23, 2024, 07:52:58 pm »
Hai, you are mentioning two versions of EA 16 and 17.
The test you do doesn't specify which version you are using for the test.
Is the generated document correct when running the script in both versions?

My suggestion is that maybe the PowerShell uses a different version than the one you use to test manually.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13233
  • Karma: +553/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RunReport with PowerShell
« Reply #5 on: October 23, 2024, 08:42:08 pm »
My suggestion is that maybe the PowerShell uses a different version than the one you use to test manually.
Maybe a 32 vs 64 bit difference?

I think there might be a difference in what's stored in the profile of the user between 32 and 64 bit.
I can imagine that includes stylesheet and cover page selection.

Geert

Stasjah

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: RunReport with PowerShell
« Reply #6 on: October 24, 2024, 06:46:53 pm »
Hai, you are mentioning two versions of EA 16 and 17.
The test you do doesn't specify which version you are using for the test.
Is the generated document correct when running the script in both versions?

My suggestion is that maybe the PowerShell uses a different version than the one you use to test manually.

It seems like PowerShell is using settings from the Register and overrulling the Coverpage set as RTFtemplates.
The Register has a value LAST_DOC_COVERPAGE which had the Value <none> while the coverpage in de documentgen is getting overrulled by this.

So when i set this value to the same CoverPage template the whole document comes out fine.

It still is a mystery to me why PowerShell OverRules this and EA it self does not.