Create a Model Using a Signon and an IQD Data Source Example

This example demonstrates how to create a model with a signon and an IQD data source.
Sub Example37()
    Dim objTransApp As Object
    Dim model As Model
    Dim datasource As IqdDataSource
    Dim signon As Signon
    Dim strIBMCognos10Location As String
    Dim strDataSource As String
    Dim strDataPath As String
    'Change these paths to match your installation
    strIBMCognos10Location = "C:\Program Files\IBM\Cognos\c10\"
    strDataSource = "prod.iqd"
    strDataPath = strIBMCognos10Location & _
         "webcontent\samples\datasources\cubes\PowerCubes\EN\great
outdoors sales\" & _
         strDataSource
    objTransApp = CreateObject("IBMCognosTransformer.ApplicationCtrl.1")
    With objTransApp
        .DataSourcePath = strIBMCognos10Location & "bin"
        .TransdaPath = strIBMCognos10Location & "CS7Gateways\bin\TransDa.exe"
    End With
    model = objTransApp.NewModel
    'Create signon before adding the data source
    signon = model.Signons.Add()
    With signon
        .Name = "great_outdoors_warehouse"
        .Description = "Signon used for prod.iqd data source"
        .UserID = "sa"
        .Password = "sa"
        .PromptForPassword = False
        .SignonType = xtrSignonType.trDataSourceSignon
        .Update()
    End With
    'Add IQD data source
    datasource = model.DataSources.Add(xtrObjectType.trIqdDataSource)
    With datasource
        .GenerateCategories = True
        .GeneratePowerCube = xtrPowerCubeGeneration.trGenerationDefault
        .IsolationLevel = 0
        .LocalPath = strDataPath
        .Name = "Products"
        .SetsCurrentPeriod = True
        .SourceType = xtrSourceType.trQuery
        .Update()
    End With
    'Auto Design, build cube, and save model
    With model
        .Name = "Products"
        .DoAutoDesign()
        .TestBuild(20, True)
        .Update()
        .SaveAs("ProductsX.mdl")
        .Close()
    End With
    objTransApp = Nothing
End Sub