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
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