How to get Cube and Dimension ID from SSAS Database programatically

Hi All,
I am processing one SSAS cube from SSIS package and processing the cubes dynamically .For this am putting the Cube ID ,Cube name, Dimension ID, Dimension Name in a table and generating the XML programmatically.
 I can right click the properties of the dimension and cube and will get the ID information. But is there any way we can get the ID information programmatically .So that On the fly I will get the information and create the XML without storing
the these information in table.
We are using 2008 R2
Thanks in advance
Roshan

Hi,
Here is the C# code you want. Try it and see.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using AMO = Microsoft.AnalysisServices;
namespace ConsoleApplication4
class Program
static void Main(string[] args)
AMO.Server oServer = new AMO.Server();
oServer.Connect(@"Provider=MSOLAP.5;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=AdventureWorksDW;Data Source=DEVWKS6\MSSQLSERVERMDX");
foreach (AMO.Database db in oServer.Databases)
foreach (AMO.Cube cube in db.Cubes)
Console.WriteLine(System.String.Format("Cube Name : {0} Cube ID : {1}", cube.Name, cube.ID));
foreach (AMO.CubeDimension dim in cube.Dimensions)
Console.WriteLine(System.String.Format("Dimension Name : {0} Dimension ID : {1}", dim.Name, dim.ID));
System.Console.WriteLine("");
System.Console.WriteLine("");
oServer.Disconnect(true);
oServer.Dispose();
System.Console.ReadLine();
If you know your target SSAS Database Name, then you could use LINQ to narrow your search. Take a look into the following Code.
AMO.Database db = oServer.Databases.Cast<AMO.Database>().Where<AMO.Database>(SSASdb => SSASdb.Name == "AdventureWorksDW").FirstOrDefault();
foreach (AMO.Cube cube in db.Cubes)
Console.WriteLine(System.String.Format("Cube Name : {0} Cube ID : {1}", cube.Name, cube.ID));
foreach (AMO.CubeDimension dim in cube.Dimensions)
Console.WriteLine(System.String.Format("Dimension Name : {0} Dimension ID : {1}", dim.Name, dim.ID));
System.Console.WriteLine("");
Best Regards...
Chandima Lakmal Fonseka

Similar Messages

  • How To Get FileType and MIME Type from a File

    Hi,
    I am using following ways to get FileType and MIME Type.
    I am able to get file type, but I am getting MIME Type as */*
    Can any one please let me know how to get MIME Type, but it should not be time consuming process.
    For File Type I am using following Code:
    private String getFileData(InputStream inStream) {
    fileName = C:\temp\temp.tiff
    String filePath = Util.createTempFile(fileName);
    RandomAccessFile raf = new RandomAccessFile(filePath, "rw");
    while (inStream.available() > 0) {
         byte[] buf = new byte[inStream.available()];
         inStream.read(buf);
         raf.write(buf);
    inStream.close();
    raf.close();
    File file = new File(filePath);
    JFileChooser chooser = new JFileChooser();
    String fileType = chooser.getTypeDescription(file);
    file.delete();
    //MIME Type I am getting from
    DataHandler data = new DataHandler(new DocumentSource(inStream));
    data.getContentType();
    data.getContentType() is not working well in all cases.
    Can any one help me on this.
    Thanks in advance,
    Ram.
    Edited by: javausers07 on Apr 15, 2009 4:25 PM

    javausers07 wrote:
    Hi,
    I am using following ways to get FileType and MIME Type.
    I am able to get file type, but I am getting MIME Type as */*
    Can any one please let me know how to get MIME Type, but it should not be time consuming process.
    For File Type I am using following Code:
    private String getFileData(InputStream inStream) {
    fileName = C:\temp\temp.tiff
    String filePath = Util.createTempFile(fileName);
    RandomAccessFile raf = new RandomAccessFile(filePath, "rw");
    while (inStream.available() > 0) {
         byte[] buf = new byte[inStream.available()];
         inStream.read(buf);
         raf.write(buf);
    inStream.close();
    raf.close();
    File file = new File(filePath);Why do you do all above?
    JFileChooser chooser = new JFileChooser();
    String fileType = chooser.getTypeDescription(file);
    file.delete();
    //MIME Type I am getting from
    DataHandler data = new DataHandler(new DocumentSource(inStream));
    data.getContentType();
    data.getContentType() is not working well in all cases.That's because there's no way to get MIME type of all files on all filesystems.
    Kaj

  • How to get Driver and url names from a connection pool

    Hi,
    How to get the DriverName and URL from an existing pool, If I know the name of
    connection pool ? Is it possible to know the name of related pool , if I know
    the name of datasource?
    Thx
    Manish

    hi
    there are 2 ways:
    url must be: jdbc:weblogic:pool[:connectionPoolID]
    or
    jdbc:weblogic:jts[:connectionPoolID] (if you want to use jts with your JDBC connection.)
    see http://e-docs.bea.com/wls/docs60//javadocs/weblogic/jdbc/pool/Driver.html
    However, I think it is safer to configure and use DataSource to get connection.
    Nicolas
    "kumar" <[email protected]> wrote:
    >
    Hi,
    How to get the DriverName and URL from an existing pool, If I know the name
    of
    connection pool ? Is it possible to know the name of related pool , if I
    know
    the name of datasource?
    Thx
    Manish

  • How to get contacts and calendar info from my old palm files

    I used to use a Palm Tungsten T3. I no longer have it but until recently I still used the Palm Desktop. My computer "died" and I was able to copy all the Palm files of of it but now I have no idea how to get the contact and calendar(less important than contacts) info in some form I can use. I do not currently have any Palm software installed on my computer. I have Microsoft Windows XP on my computer now and use Outlook or Outlook Express. Does anyone have any advice for me. Thanks in advance.
    Post relates to: Tungsten T3

    I'm having the same problem.  Desktop 4.1.4 on old PC.  New PC with Win 7.   Loaded 6.2 and when I went to Import 6.2 is looking for .aba files.  Old PC has all .dat files.  How do I import or transfer addresses and other contact info to new PC??  Thanks.

  • How to get the last SCN number from catalog database

    Hi All,
    I have a catalog database where my PROD database is registered. Evereyday at 12AM rman takes the hot backup of PROD.
    Now I want to create a auxillary database using the last RMAN backup, for this I want to restore using the SCN from the catalog views.
    Please help me to get the SCN number from the RC_ views.
    Regards,
    Bikram

    asifkabirdba wrote:
    Current SCN:
    Use the dbms_flashback package to get the current SCN. This value will be used during instantiation at the destination site, as well as by RMAN when duplicating the database.
    SET SERVEROUTPUT ON
    DECLARE
    until_scn NUMBER;
    BEGIN
    until_scn:=
    DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER;
    DBMS_OUTPUT.PUT_LINE('Until SCN: ' || until_scn);
    END;
    Regards
    Asif KabirHello,
    i am a bit confused,
    SELECT CURRENT_SCN FROM V$DATABASE;
    6272671324
    and from your package
    SET SERVEROUTPUT ON
    DECLARE
    until_scn NUMBER;
    BEGIN
    until_scn:=
    DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER;
    DBMS_OUTPUT.PUT_LINE('Until SCN: ' || until_scn);
    END;Until SCN: 6272671267
    why are they different, and why first result is lower than yours? can you explain please, thank you
    Ugur MIHCI

  • How do i store and fetch image from the Database(Access)

    i am facing one problem in inserting the image into the database.the steps i followed as
    1)i have created one database(access) as "Image" and into that one table as "Image" and field as "image"
    type of the field is ole object.
    2)i have inserted one image into the image field through "database.vi"
    3)now i am trying to get the image from the database by "Fetching Example.vi"
    4)it will succesfully retrieve the image from that field .
    5)but when i close the both programs and reopen those that time i am unable to get retrieve the image.
    Attachments:
    Add_to_Database.vi ‏78 KB
    Fetch_from_database.vi ‏67 KB

    I would like to suggest different approach for saving the images in the database.
    I was working on Medical Imaging Company. The way we save the images in real-time was by writing the name and path of the images to database.
    The images themselves where saved directly to disk.
    I don�t think that access is very good in taking care of GBytes of data.
    It happens some time that the database gets damage. If you have the images separately you can create fix procedure. (We had one).
    Good Lack,
    Amit Shachaf,

  • How to get Essential and additional qualifications ,From which table

    Hi all,
    In one of my requirement, the report should show the Qualifications and Essential qualifications columns in the output.
    Requirement is :
    1. I have brought qualifications of Applicant from PB0024 table.
    2. I need to compare these with the Qualifications maintained in Job for the pernr.
    3. There are two types of Qualifications namely essential Qualifications and additional Qualifications.
    4.
    How do we get the Qualifications maintained for a job/Position?
    How can we distinguish between Qualifications and essential Qualifications maintained for a job at the database table level ?
    Please reply ASAP.
    Regards,
    Rama.P

    Hi Dilek Ersoz Adak,
    How can we get the jobs assigned to a position ,from which table ?
    Actually i am doing a custom recruitment report which displayes several fields along with the qualificaions and additional qualifications.
    For the two fileds: in the spec it is given as:
    14.     Qualification (This is maintained in HRPE_PROFQ_TBJID-infotype 0024 of the employee. Thus, check Position maintained for the employee in P4002_OBJID, against this position check for Essential Qualification, related object type u2018Qu2019 HRPE_PROFQ_ESSENTIAL, compare this with the qualifications maintained for the employee in Infotype 0024, and display wherever these maintained.)
    15.     Additional Qualification (This is maintained in HRPE_PROFQ_TBJID-infotype 0024 of the employee. Thus, check Position maintained for the employee in P4002_OBJID, against this position check for Essential Qualification, related object type u2018Qu2019, compare this with the qualifications maintained for the employee in Infotype 0024, and display all qualifications for which HRPE_PROFQ_ESSENTIAL is not maintained.)
    16.     Proficiency (HRPE_PROFQ_PROFC_TEXT)
    in clear :
    1.       Positions (Object Type S) are linked to Job through relationship A 007
    2.       In APDISCOM scenario, Qualifications (Object Type Q) are attached to Object u2018Jobu2019 (Object Type C) through Transaction Code PPPM
    3.       Now, for a Job there can two types of qualifications maintained Essential Qualifications (ii) Additional Qualifications
    4.       For essential qualifications: Against a Qualification we can maintain u201Cessential check boxu201D HRPE_PROFQ
    5.       For additional qualifications: Those qualifications for which HRPE_PROFQ is not maintained
    6.       Now, for an applicant, Qualifications are maintained in Infotype 0024, wherein the necessary qualifications would be selected.
    7.       In the report for field of u201Cessential qualificationu201D, check for qualifications maintained in Infotype 0024 and compare it with qualifications maintained in Job (through Position assigned to the applicant in P4002_OBJID)
    8.       Check for essential qualification HRPE_PROFQ maintained in Job and check whether the same Q is maintained in Infotype 0024 for the applicant, if yes, then generated Text of the Q
    9.       If there are any additional qualifications which are maintained in the job and not maintained in Infotype 0024, DONu2019T GENERATE ANYTHING IN FIELD
    10.   If there are any additional qualifications which are maintained in the job and if same are maintained in Infotype 0024, generate Q text under field of u201CAdditional Qualificationsu201D in the report
    11.   If there are any extra qualifications in infotype 0024, which are not maintained in Job, then generate Q text under field of u201CAdditional Qualificationsu201D in the report
    Please provide the procedure.(For clarity copy and paste the text in a MS-word)
    Please reply ASAP.
    Regards,
    Rama.P
    Edited by: Rama Chary on Dec 9, 2009 1:28 AM

  • How to get UUTPassed and UUTFailed count from C# ActiveX control

    Hello,
    My operator interface uses TestStand ActiveX control in C#. I will use the OP to test a bench of DUTs, which runs the same sequence file. I would like to know the total UUT-Tested, UUTPassed and UUTFailed count after each DUT tested. Is there any embedded parameter does the job for me and how could I get it? If there is not, I have to create internal variables in C# to do the job.
    Thanks
    Regards,
    Solved!
    Go to Solution.

    No, there is no build in function for this. So either you will have to implement something like this in on of the following:
    a) The user interface
    b) The SequenceFile (as long as it is not unloaded in between)
    c) The process model
    d) Use an external tool for analysis
    If you are already working with databases for reporting, i would suggest using d). If not, you can choose. But modifying the process model is not recommended (if other, simple solutions are available), i wouldn't recommend c).
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How to get WIDTH and HEIGHT fields from applet tag?

    I am developing an applet using JDK1.1 (to ensure microsoft jvm compatability).
    A problem I'm facing is that there are no getWidth() or getHeight() method for Applet in 1.1, so I am hoping I can get this info from my html: <APPLET CODE="MyApplet" WIDTH=600 HEIGHT=856></APPLET>
    getParameter didn't work, so does anyone have any ideas how I could get the width and height?
    Cheers,
    James

    Write a jpeg decoder that can figure out how to determine the width/height of a jpeg file? Google it.
    Or if you're really lazy, load each jpeg using the
    Toolkit.loadImage( URL ) function and use getWidth/getHeight from there, but that's slow.

  • How to get workbook and folder list from backend

    Hi,
    I want a list of workbook and their respective folders in excel. How can we find out this from backend?
    Thanks ,
    Sam

    Hi,
    You can try this:
    select d.doc_name,
    d.doc_developer_key,
    x.ex_to_par_name,
    e.exp_name,
    b.ba_name
    from eul10g_us.eul5_documents d,
    eul_us.eul5_elem_xrefs x,
    eul_us.eul5_expressions e,
    eul_us.eul5_ba_obj_links o,
    eul_us.eul5_bas b
    where x.ex_from_type = 'DOC'
    and x.ex_from_id = d.doc_id
    and x.ex_to_id = e.exp_id
    and e.it_obj_id = o.bol_obj_id(+)
    and o.bol_ba_id = b.ba_id(+)Tamir

  • My boyfriend purchased the new operating system for the mac book pro it was send to his email but we cant figure out how to get it and download it from the email

    how do we download our operating system purchase from our email it was sent to?

    You should have received a redemption code via email if you purchased Lion or Mountain Lion that would allow you to download the OS via the Mac App Store. If you purchased an earlier version it would come on discs, usually model-specific.
    Call back with some more information...
    Clinton
    MacBook Pro (15-inch Late 2011), OS Mavericks 10.9.4, 16GB Crucial RAM, Crucial M500 960GB SSD, 27” Apple Thunderbolt Display

  • How to get Operating System Space Info from Oracle database using SQL

    Our oracle databases are installed on Unix operating system. Currently our DBA wrote a view to get space info of table spaces and He is requesting me to add Operating system level(file system) drive space info to the same report.
    Can you please let me know the easiest way to get this information to sql table so that it can be used for reporting purposes?

    You should be able to create a shell script with the OS commands to generate the information for the mount points that you want to access in Oracle, then read it in as an external table using the preprocessor feature of external tables:
    http://download.oracle.com/otndocs/products/database/enterprise_edition/utilities/pdf/xtables_preproc11g_1009.pdf

  • I broke my iPhone 5 now using a 4 but don't know if or how to get my photos ect..from the 5 to the 4.can I do this and how plse help

    I broke my iPhone 5 now using a 4 but don't know if or how to get my photos ect..from the 5 to the 4.can I do this and how plse help

    Restore the backup of your iPhone 5 to your iPhone 4.  It will contain your camera roll photos. 
    To do this, first make sure the iPhone 4 is running the same or higher version of iOS as your iPhone 5 was.  If it isn't, you'll need to update it first.  Then, to restore the iCloud backup, you'll have to begin by erasing the iPhone 4.  If you have any newer data on the iPhone 4 that is not contained in the iPhone 5 backup, you'll need to save that first.  When you're ready, go to Settings>General>Reset, tap Erase All Content and Settings, then go through the set screens on the iPhone 4 and when given the option, choose Restore from iCloud backup and follow the prompt, choosing the backup of your iPhone 5 to restore to.  Be sure it is connected to wifi and your charger as it is restoring the backup.

  • How do I get date and time component from a DATE object?

    Hi All,
    I need to get date and time separately from a DATE object, does
    anyone know what function I should call? GetDate()? GetTime()?
    I need this in a SELECT statement.
    Thanks in advance and looking forward to your early reply.
    Regards.
    Gladywin
    30/11/2001

    Hello,
    See following SQL.
    select to_char(sysdate,'dd/mm/rrrr') today_date,
    to_char(sysdate,'hh24:mi') now_time
    from dual
    Adi

  • Can't view my Cube and Dimension Data with the Cube Viewer

    I'm new in using OWB, i'm using Oracle 10g release1 with OWB R2 also Oracle WorkFlow 2.6.3.
    When studying with the steps from the OTN pages (start01, flat-file02, relational-wh-03, etl-mappings, deployingobjects, loading-warehouse and bi-modeling)
    the loading was success, i guess...
    But when I want to see the data in the cube and dimension, an error occurs.
    It says
    " CubeDV_OLAPSchemaConnectionException_ENT_06952??
    CubeDV_OLAPSchemaConnectionException_ENT_06952??
         at oracle.wh.ui.owbcommon.dataviewer.dimensional.DataViewerConnection.connect(DataViewerConnection.java:115)
         at oracle.wh.ui.owbcommon.dataviewer.dimensional.DimDataViewerMain.BIBeansConnect(DimDataViewerMain.java:433)
         at oracle.wh.ui.owbcommon.dataviewer.dimensional.DimDataViewerMain.init(DimDataViewerMain.java:202)
         at oracle.wh.ui.owbcommon.dataviewer.dimensional.DimDataViewerEditor._init(DimDataViewerEditor.java:68)
         at oracle.wh.ui.editor.Editor.init(Editor.java:1115)
         at oracle.wh.ui.editor.Editor.showEditor(Editor.java:1431)
         at oracle.wh.ui.owbcommon.IdeUtils._tryLaunchEditorByClass(IdeUtils.java:1431)
         at oracle.wh.ui.owbcommon.IdeUtils._doLaunchEditor(IdeUtils.java:1344)
         at oracle.wh.ui.owbcommon.IdeUtils._doLaunchEditor(IdeUtils.java:1362)
         at oracle.wh.ui.owbcommon.IdeUtils.showDataViewer(IdeUtils.java:864)
         at oracle.wh.ui.owbcommon.IdeUtils.showDataViewer(IdeUtils.java:851)
         at oracle.wh.ui.console.commands.DataViewerCmd.performAction(DataViewerCmd.java:19)
         at oracle.wh.ui.console.commands.TreeMenuHandler$1.run(TreeMenuHandler.java:188)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) "
    Can somebody explain what is happening, I really don't understand, when the cube viewer window appears, there's no data in it....
    I realy need help with this...

    I'm new in using OWB, i'm using Oracle 10g release1 with OWB R2 also Oracle WorkFlow 2.6.3.
    When studying with the steps from the OTN pages (start01, flat-file02, relational-wh-03, etl-mappings, deployingobjects, loading-warehouse and bi-modeling)
    the loading was success, i guess...
    But when I want to see the data in the cube and dimension, an error occurs.
    It says
    " CubeDV_OLAPSchemaConnectionException_ENT_06952??
    CubeDV_OLAPSchemaConnectionException_ENT_06952??
    at oracle.wh.ui.owbcommon.dataviewer.dimensional.DataViewerConnection.connect(DataViewerConnection.java:115)
    at oracle.wh.ui.owbcommon.dataviewer.dimensional.DimDataViewerMain.BIBeansConnect(DimDataViewerMain.java:433)
    at oracle.wh.ui.owbcommon.dataviewer.dimensional.DimDataViewerMain.init(DimDataViewerMain.java:202)
    at oracle.wh.ui.owbcommon.dataviewer.dimensional.DimDataViewerEditor._init(DimDataViewerEditor.java:68)
    at oracle.wh.ui.editor.Editor.init(Editor.java:1115)
    at oracle.wh.ui.editor.Editor.showEditor(Editor.java:1431)
    at oracle.wh.ui.owbcommon.IdeUtils._tryLaunchEditorByClass(IdeUtils.java:1431)
    at oracle.wh.ui.owbcommon.IdeUtils._doLaunchEditor(IdeUtils.java:1344)
    at oracle.wh.ui.owbcommon.IdeUtils._doLaunchEditor(IdeUtils.java:1362)
    at oracle.wh.ui.owbcommon.IdeUtils.showDataViewer(IdeUtils.java:864)
    at oracle.wh.ui.owbcommon.IdeUtils.showDataViewer(IdeUtils.java:851)
    at oracle.wh.ui.console.commands.DataViewerCmd.performAction(DataViewerCmd.java:19)
    at oracle.wh.ui.console.commands.TreeMenuHandler$1.run(TreeMenuHandler.java:188)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) "
    Can somebody explain what is happening, I really don't understand, when the cube viewer window appears, there's no data in it....
    I realy need help with this...

Maybe you are looking for