Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FREE MACRO COGNOS GIFT

Status
Not open for further replies.

infocom

IS-IT--Management
Oct 10, 2002
8
FR
hello world,

If you have Impromptu catalogs with many user profils, you can use the macro code below to update the connection string for each profils. It works fine, you won't spend your time anymore.


-------------------------------------------------
Option Explicit

global objImpApp As Object
global objImpCat As Object

global objDBConnection As Object
global objUser As Object

global strUserName As String
global strSubUserName As String
global strSub2UserName As String
global strSub3UserName As String
global strSub4UserName As String
global strSub5UserName As String

const catalog as string = "C:\your_cat.CAT"
const newlog as string ="new_login"
const newpwd as string ="new_pass"


'Registry Function Prototypes
Declare Function Maj_BdDPwd()


Sub Main()

dim intUserName, intSubUserName as integer
dim intSub2UserName, intSub3UserName as integer
dim intSub4UserName as integer
dim i, j, k,l as integer

Set objImpApp = CreateObject("CognosImpromptu.Application")

objImpApp.OpenCatalog catalog

Set objImpCat = objImpApp.ActiveCatalog

intUserName = objImpCat.ActiveUserClass.UserClasses.count

Set objUser = objImpCat.ActiveUserClass
call Maj_BdDPwd
Set objUser = Nothing


for i =1 to intUserName

intSubUserName=objimpcat.activeuserclass.userclasses(i).userclasses.count

Set objUser = objimpcat.activeuserclass.userclasses(i)
call Maj_BdDPwd
Set objUser = Nothing

if intSubUserName <> 0 then

for j =1 to intSubUserName

intSub2UserName=objimpcat.activeuserclass.userclasses(i).userclasses(j).userclasses.count

Set objUser = objimpcat.activeuserclass.userclasses(i).userclasses(j)
call Maj_BdDPwd
Set objUser = Nothing

if intSub2UserName <> 0 then

for k =1 to intSub2UserName

intSub3UserName=objimpcat.activeuserclass.userclasses(i).userclasses(j).userclasses(k).userclasses.count

Set objUser = objimpcat.activeuserclass.userclasses(i).userclasses(j).userclasses(k)
call Maj_BdDPwd
Set objUser = Nothing


if intSub3UserName <> 0 then

for l =1 to intSub3UserName

intSub4UserName=objimpcat.activeuserclass.userclasses(i).userclasses(j).userclasses(k).userclasses(l).userclasses.count

Set objUser = objimpcat.activeuserclass.userclasses(i).userclasses(j).userclasses(k).userclasses(l)
call Maj_BdDPwd
Set objUser = Nothing

if intSub4UserName <> 0 then
MsgBox "The name of the Sub user is " & strSub4UserName & " ( " & intSub4UserName
end if

next
end if
next
end if
next
end if
next

Set objImpCat = Nothing

Set objImpApp = Nothing

End Sub


function Maj_BdDPwd()

Dim objDBConnection As Object

Set objDBConnection = objUser.DatabaseConnections(1)
objDBConnection.UserName = newlog
objDBConnection.PlainTextPassword = newpwd
objImpCat.Save
Set objDBConnection = Nothing

end Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top