US and Worldwide: +1 (866) 660-7555
Results 1 to 3 of 3

Thread: Create Expression on a Dimension

  1. #1
    Join Date
    Dec 2012
    Posts
    121

    Default Create Expression on a Dimension

    Hi all,
    i have a question. I want to extract from a table only a subset of values.
    I have mobile-phone models on this table and i want to select someones of these.
    I tried to write on schema workbench a key expression, but it not works. It returns me all the mobile models.

    here is the sql expression:

    test_devices.model in ('GT-I9305','GT-I9210','GT-P7320','LG-P936','C6603',
    'GT-N7105',
    'PadFone 2',
    'LT25i',
    'GT-N8020',
    'LG-E975',
    'GT-I8730',
    'ASUS Transformer Pad TF300TL',
    'HTC Holiday',
    'HTC One XL',
    'SmartQT10',
    'C5303',
    'XT925',
    'GT-I9505',
    'HTC One',
    'LG-P875',
    'HTC One SV',
    'GT-N5120',
    'iPhone5',
    'iPad4',
    'iPad Mini',
    'HUAWEI P2-6011',
    'SGP321',
    'U9202L-1',
    'GT-I9205',
    'C6503',
    'LG-F240S',
    'PadFone Infinity',
    'ME302KL',
    'SM-N9005',
    'Vodafone Smart 4G',
    'GT-I9295',
    'Nexus 7',
    'GT-I9195',
    )



    Any ideas?

    Yamas,
    Marco

  2. #2
    Join Date
    Dec 2010
    Posts
    272

    Default

    Ciao Marco,
    the device model is a dimension level, isn't it?
    If true, you could use a view in its hierarchy definition:

    Code:
    <Dimension name="Device Model">
    <Hierarchy name="Device Model" hasAll="true" allMemberName="All Models" primaryKey="device_id">
    <View alias="test_devices_view">
    <SQL dialect="generic">
    SELECT device_id, ..., model, ... FROM test_devices WHERE
    model in ('GT-I9305','GT-I9210','GT-P7320','LG-P936','C6603',
    'GT-N7105',
    'PadFone 2',
    'LT25i',
    'GT-N8020',
    'LG-E975',
    'GT-I8730',
    'ASUS Transformer Pad TF300TL',
    'HTC Holiday',
    'HTC One XL',
    'SmartQT10',
    'C5303',
    'XT925',
    'GT-I9505',
    'HTC One',
    'LG-P875',
    'HTC One SV',
    'GT-N5120',
    'iPhone5',
    'iPad4',
    'iPad Mini',
    'HUAWEI P2-6011',
    'SGP321',
    'U9202L-1',
    'GT-I9205',
    'C6503',
    'LG-F240S',
    'PadFone Infinity',
    'ME302KL',
    'SM-N9005',
    'Vodafone Smart 4G',
    'GT-I9295',
    'Nexus 7',
    'GT-I9195',
    )
    </SQL>
    </View>
    <Level name="Model" column="model" type="String" />
    </Hierarchy>
    </Dimension>
    or

    Code:
    <Dimension name="Device Model">
    <Hierarchy name="Device Model" hasAll="true" allMemberName="All Models" primaryKey="device_id">
    <Table name="test_devices_view" /> <!-- test_devices_view is a view that you'll create in your db -->
    <Level name="Model" column="model" type="String" />
    </Hierarchy>
    </Dimension>
    Bye
    Luca

  3. #3
    Join Date
    Dec 2012
    Posts
    121

    Default

    Yes, thanks for the response, but i solved it now with your same solutions!!

    :-)

    Best Regards,
    Marco

Tags for this Thread

Posting Permissions

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