4 Replies Latest reply on May 13, 2011 10:02 AM by andreas

    Read Module names from MDB

    Aantje

      Hi everybody,

       

      I have an ACE module in which I want to read the submodules from a module in the MDB. The names of these submodules must be written to a list.

       

      So I have a modulepath: "Server\Context\Mainmodule\"

       

      This Mainmodule contain more than one Submodules, and the names of these modules must be add in a stringlist.

       

      So the coding must be something like below, but I can get the job done. So any use is helpfull.

       
              ' Only read the TE blocknames if they are available in the MDB
              Modulerootpath = "Server\Context\Mainmodule\"
              PIModulesroot = PIACEBIFunctions.GetPIModuleFromPath(Modulerootpath)
      
              For Each PIModule In PIModulesroot.PIModules
                  TE_Block = .........
                  TE_Blocklist.Add(TE_Block.ToString)
              Next
      

       

        • Re: Read Module names from MDB
          andreas

          Arie,

           

          just a quick note - the context should be "\\Server\Context\Mainmodule"

          • Re: Read Module names from MDB

            Is your module path the same as the module being used as a context for the calculation? If so, then you could simply use the "Context" property from the base class:

             
            PIModulesroot = PIACEBIFunctions.GetPIModuleFromPath(Context) 
            

             

              • Re: Read Module names from MDB
                Aantje

                I've found the solution; to read the submodules from my mainmodules to a list I now use the following code:

                 
                myContext = PIACEBIFunctions.GetPIModuleFromPath(PIACENetInternalFunctions.PIACEMDBFunctions.GetContextName(Name))
                       ' Only read the TE blocknames if they are available in the MDB
                        For Each PIModule In myContext.PIModules
                            TE_Block = PIModule.Name.ToString
                            TE_Blocklist.Add(TE_Block.ToString)
                        Next