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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export Impromptu Catalog Userclass to a file

Status
Not open for further replies.

yenfen

Programmer
Sep 2, 2003
34
0
0
US
Hi All,
Is it possible to export userclass created in the catalog to a file? Currently, we have 800 userclasses in the catalog. It's difficult to replicate the same useclasses in Access Manager. Is there an easier way to do this?

Thanks in advance!!!
 
You can modify this:
Code:
Sub Main()
   Dim objImpApp As Object
   Dim objImpCat As Object
   Dim strUserName As String
   Set objImpApp = CreateObject("CognosImpromptu.Application")
   objImpApp.OpenCatalog "K:\Catalogues\test.cat"
   Set objImpCat  = objImpApp.ActiveCatalog
   count =objImpCat.ActiveUserClass.UserClasses.Count
Select case Count   
case 0
   MsgBox "No user classes apart from Creator"
   goto skip
case else
   For x = 1 to count
   strUserName = strUserName + Chr(10) + objImpCat.ActiveUserClass.UserClasses(x).Name 
   Next x
   MsgBox "The names of the users are: " & strUserName
skip:
   Set objImpCat = Nothing
   Set objImpApp = Nothing
end select
End Sub

soi la, soi carré
 
Hi, I tried the code but it only returns the active user class which is user. I was wondering if I can return all child userclasses under user?

Thank you!!
 
Well, it returns the userclasses in my catalog. The membership is another matter. Have a look at 'UserClasses Collection' in the Macro help - children are possible.
Happy Friday,
lex

soi la, soi carré
 
Swap in this inelegant code for the loop:
Code:
For x = 1 to count
         strUserName = strUserName + Chr(10) + objImpCat.ActiveUserClass.UserClasses(x).Name 
         Set objImpUser = objImpCat.ActiveUserClass.UserClasses(x)
         index = objImpUser.UserClasses.Count
         If index = 0 then goto jump
            For y = 1 to index
               strUserName = strUserName + chr(10) + chr(9) + "subuser:" + objImpUser.Userclasses(y).Name 
            Next y
jump:Next x

and that'll give you one level down.

Obviously it would be better if the script was recursive to cover all indicies of user classes, but I'll leave that up to you - [happy]

soi la, soi carré
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top