I want to generate dynamic MDX query

  • Please send me a sample code to generate MDX query for AD-Hoc report. your suggestions will be highly appreciated.

    Thanking you in advance

    Puja Shah

  • Hi Puja,

    I think...for generating MDX Query, you can directly connect to and access the respective cube . So thereafter, by simply dragging the desired measures and dimension values, the query will be created automatically..

    Or if this is not the case, then could you please send some additional information regarding the scenerio you are working on?

    Thanks,

    Niraj

  • Thanks for the reply

    This is the MDX query whose result i want in grid view.

    where,

    m= {measure name of measure group}

    d={dimension name}

    a={attribute hierarchy}

    String ml_MDXquery = @"SELECT ([Measures].[" + m + "]) on columns,([" + d + "].[" + a + "].DefaultMember) ON rows FROM [Cube Demo]";

    Microsoft.AnalysisServices.AdomdClient.AdomdCommand ol_AdomdCommand = o_AdomdConnection.CreateCommand();

    ol_AdomdCommand.CommandText = ml_MDXquery;

    AdomdDataAdapter ol_AdomdDataAdapter = new AdomdDataAdapter(ol_AdomdCommand);

    DataSet ol_DataSet = new DataSet();

    ol_AdomdDataAdapter.Fill(ol_DataSet);

    GridView(ol_DataSet.Tables[0]);

    Here the no. of measures & dimensions are fixed. I want to generate an MDX query that can have any no. of measures and dimensions.

    I want to generate MDX query through my application not using SQL Management studio.

    Please give some examples to write a SELECT MDX query that can change no. of measures and dimensions according to the selection of measures and dimensions.

    Any help will be greatly appreciated.

    Once again ,Thanking you in advance

    Puja Shah

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply