Business Intelligence with MicroStrategy Cookbook
上QQ阅读APP看书,第一时间看更新

Other attribute forms

Attributes may have more forms than just an ID or a name. More often than not you'll find long descriptions, SKUs, Social Security Numbers, previous companies' codes still in use, and so on. Or, in the case of a customer, you may have an e-mail address that sometimes you want to use in a report. Those descriptive fields that uniquely refer to an element of an attribute can be used as alternate forms. When creating an alternate form, it is always useful to ask the question: is this a form or a totally different attribute? The customer's birthday, for example, would be a different attribute, since we may later filter or GROUP BY this column; and surely does not uniquely identify a single customer.

Getting ready

You need to have completed the previous recipes to do this one. We are now adding the long description to the Product attribute.

How to do it...

We are modifying the Product attribute:

  1. Go to the Schema Objects | Attribute folder. Double-click on the yellow Product icon.
  2. If you see a message like the one in the following screen capture, it is very important that you click on the second option Edit: This will lock all schema objects in this project from other users. Otherwise, you won't be allowed to modify the attribute:
  3. When the Attribute Editor opens, click on New.
  4. In Create New Form Expression drag the column EnglishDescription to the Form Expression text area. Mapping method should be Manual. Click on OK.
  5. Check the DimProduct table, and now look at the Form general information area down to the left.
  6. In the textbox called Name, type LDESC and close this dialog clicking on the OK button. See that in the Attribute Editor now we have three forms.
  7. Click on Save and Close, update the schema.

How it works...

We can have as many forms as we want in an attribute, as long as they come from the same lookup table. Forms can be text, numbers, dates, or other datatypes. When it comes to displaying forms on a report, DESC will be always displayed by default (if present), and you will have the option to select which other forms are shown by right-clicking on an attribute header.

There's more...

If you selected Read Only in step 2 in this recipe, the project schema is now locked. You won't be able to make changes until you unlock it. This is useful in development environments where multiple persons are working on the same metadata and you want to freeze the project.

To unlock it, use the Schema | Read Only Mode… menu and uncheck the option.

Note

You can watch a screencast of this operation at:

Exercise 7

Create a new form for the Customer attribute. Use the EmailAddress field from the DimCustomer table. Give the name EMAIL and in the Form format field select the Type as Email.