create dimensions programmatically

Discussion in 'microsoft.public.sqlserver.datamining' started by anonymous_user, May 29, 2007.

  1. I am trying to create dimensions to an analysis services programmatically
    This is the code I am using
    DimensionAttribute attr;

    attr = dim.Attributes.Add("KEYCOLUMN");
    attr.Usage = AttributeUsage.Key;
    attr.Type = AttributeType.Regular;
    attr.OrderBy = OrderBy.Key;
    attr.KeyColumns.Add(CreateDataItem(db.DataSourceViews[0], "InvitQuest", "Year"));

    attr = dim.Attributes.Add("NotInterested");
    attr.Usage = AttributeUsage.Regular;
    attr.Type = AttributeType.Regular;
    attr.OrderBy = OrderBy.Key;
    attr.KeyColumns.Add(CreateDataItem(db.DataSourceViews [0], "Names", "NotInterested"));


    It creates the dimensions but when I try to process it it gives me errors.
    Is there any other way to do this ?
    anonymous_user, May 29, 2007
    1. Advertisements

  2. anonymous_user

    Dejan Sarka Guest

    The code seems quite all right. What error do you get? I suspect two things:
    - wrong binding in attr.KeyColumns.Add(... part
    - some locks when you try to process the dimension. have you tried full
    process on complete database?
    Dejan Sarka, Jun 11, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.