cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MegaAutomation vs GraphQL

Solved
JuhaszZsolt
Contributor

MegaAutomation vs GraphQL

Hello,

 

At one of my partner we upgraded from V2 to V4.

In V2 he used MegaAutomation Excel macros to query data from Hopex. He sad he was able to access all data using mega queries.

In V4 the MegaAutomation macro doesn't work. He wrote GraphQL macro, which works well, but he can access a small portion of the objects.

 

Can you help me the following:

Can he use in V4 the MegaAutomation macros? Has anybody got a sample code to access the MegaAutomation components?

Is it true that only a small portion of object can be accessed using GraphQL?

 

The V2 MegaAutomation code part:

Dim oMegaEnv As New MegaCurrentEnv
Dim objMegaRoot As MegaMapp.MegaRoot
Set objMegaRoot = oMegaEnv.GetRoot  'In V2 it works, in V4 there is an error.

 

Dim ocApp As MegaCollection

Set ocApp = objMegaRoot.GetSelection("Select [Org-Unit] Where [Name] Like 'comp'", "name")

 

Thank you:

Zsolt

4 Replies
oguimard
MEGA

Hello,

 

The product MEGA as been renamed HOPEX for a while. Some API have kept the name MEGA and some have been renamed HOPEX.

 

VB API in Excel

 

In your case, in V4 you must reference in Excel the new name "HOPEX Automation Components" that will reference the mg_mapp.dll that you need to run your macro.

 

ref in excel2.pngref in excel3.png

 

 

GraphQL API

 

The web API cover a wide range of solution : ITPM, BPA, IA, ITARC... We obviously encourage your to use this new API. More information here :https://community.mega.com/t5/REST-API/bd-p/api 

 

As per the limitation you mentioned it depends on what you are trying to achieve. The read/write of the metamodel content is widely possible.

 

Some part of the domain might be missing. in that case you have the possibility to add the part that you need. More information here https://community.mega.com/t5/REST-API/Create-custom-schema-SDL-JSON-custom-endpoint/m-p/24218#M16 

 

 

 

 

 

Hello oguimard,

 

I sent him the informations, but hi sad he using the Hopex automation components but at the "GetRoot" line he gets a "GetRoot of object MegaCurrentEnvironment failed" error message.

 

Thank you,

Zsolt

oguimard
MEGA

You need to provide more details :

  • screenshot of the references
  • screenshot of the error details
  • version of V4 (CP1 ? CP2 ... ?)

 

It works the same as in V4 as in V2.

 

Here is an example of VB that works in V4

  • option 1 you use the "Open" method
  • option 2 you use the openEx method.

 

Caution :

There can be only one MEGA process (mgwmapp.exe) open at a time.

 

 

Option Explicit
' ---- Environment, database, user, and password information ----


' ---- Set Environment, database, user, and password information ----
Dim oMegaApp
Dim oEnvironment
Set oMegaApp = CreateObject("Mega.Application")
Set oEnvironment = oMegaApp.Environments.Item("C:\Users\Public\Documents\HOPEX V4\ONE")

' ---- Create Transactions and Connect to MEGA ----
oEnvironment.CurrentAdministrator = "Administrator"
oEnvironment.CurrentPassword = ""
Dim oDatabases
Dim oDatabase
Dim MyRoot
Set oDatabases = oEnvironment.Databases
Set oDatabase = oDatabases.item("DEMO")


' Option 1

' ---- Create Transactions and Connect to MEGA ----
'Dim oMegatransaction
'Set oMegatransaction = oEnvironment.Transactions.Create("DEMO", "ogd")
'oMegatransaction.Password = ""
'Set MyRoot = oMegatransaction.Database.Open

' Option 2

Set MyRoot = oDatabase.OpenEx("-User:Mega -Role:HOPEX Administrator -TranType:Micro -OpenMode:W")

 

 

 

Hello Oguimard!

 

Thank you the VB code works well!

 

Sincerelly,

Zsolt