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")
Solved! Go to Solution.
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.
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
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.
You need to provide more details :
It works the same as in V4 as in V2.
Here is an example of VB that works in V4
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")