Accessing multiple Idea Databases

3 posts / 0 new
Last post
randywb
Offline
Joined: 08/25/2022 - 11:54
Accessing multiple Idea Databases

I have a process that comes out of the smart analyzer that builds a what I will call a  base database.  Let's call it DB.  It then builds DB(1) DB(2) etc..  I want to programmatically concatenate then into one database.  The number of databases underneath the base is not the same.
 
I see two ways of doing it. 
 

  1.  Go into windows find DB and DB(1) etc in the file structure.  I can check and see if the file exists or not.  If I check for DB(6) and it is not there.  I am done and I process Db through     db(5)  If this is the way to do It I know how to do that. 

 
 

  1. A better way would exists if Idea itself has commands/codes to access internal databases.

 
 
My question is it  1 or 2,  If 1 I am good.  If it is 2 what are the commands to access Idea databases.  If there is another alternative I am open to that as well.
 
Thanks,
 
Randy

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Randy,

There is a function that I think you are looking for.  If you look in the Language Browser under Project Management there is a function called ProjectManagement.Database that returns a collection of the IDEA files located in the project.  Here is some example code for you:


Sub Main
	' Set the task type.
	Set task = Client.ProjectManagement
	
	' Obtain a list of databases.
	Set collection = task.Databases
	
	' Process the list of databases.
	NameList = "Database List:" & Chr(13)
	
	For Each ThisName In collection
		' Build a string containing all of the names.
		NameList = NameList & ThisName & Chr(13)
	Next 
	
	' Display the list on screen.
	MsgBox NameList
	
	' Clear the memory.
	Set collection = Nothing
	Set task = Nothing

End Sub 
randywb
Offline
Joined: 08/25/2022 - 11:54

This is exactly what I am looking for thanks.