Results 1 to 3 of 3

Thread: Is it possible to create a dynamic User defined type?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    72

    Question

    I have a type:

    Public Type autoPivotCreationType
    clicks As Integer ' Integer variable stores clicks.
    campaignName As String ' String variable stores campaign name.
    jobName As String ' String variable stores job name.
    strategyName As String ' String variable stores strategy name.
    dateTime As String ' Date variable stores the date of a transaction.
    isEmpty As Boolean
    End Type


    I want this to be dynamic where I can add subcategories within the type. For Example:

    Public Type autoPivotCreationType
    isEmpty As Boolean 'isEmpty being a constant paramater within this type
    End Type

    and then I can add other subtypes later... or somehow create the dynamic subs when creating a variable of autoPivotCreationType.

    Like:

    Dim arrayForTopTen(10) As autoPivotCreationType
    and being able to somehow set stuff like:

    arrayForTopTen(1).test = ""
    arrayForTopTen(1).someOtherNewField = ""

    Ok... hope this makes some sort of sense. Thanx in advance for teh help.

    -cLocKwOrk




  2. #2
    Lively Member
    Join Date
    Aug 2000
    Location
    Australia
    Posts
    82
    Don't think that dynamically defining/assigning Type is possible, but why not use nested UDT.

    For example

    Type typeEmployee
    FirstName as string
    LastName as string
    end type
    Dim Employee as typeEmployee

    Type typeDepartment
    DepartmentName as string
    ThisEmploy as typeEmployee
    end type
    Dim Department as typeDepartment

    Department.DepartmentName = "Sales"
    Department.ThisEmploy.FirstName = "Fred"
    Department.ThisEmploy.LastName = "Jones"

    You can declare new structures, based on existing structs. The Employee Struct becomes a subset of the Department Struct.

    Hope this is of some assistance

    Adrian

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    72
    That's funny... while I was waiting for a reply, I decided to try it out that way just in case the dynamic way wasn't possible.

    Thanks for the help. =)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width