1 Reply Latest reply: Apr 25, 2018 7:08 AM by Mat Smith RSS

    Listing master items using .NET SDK

    Mat Smith

      Hi there,

       

      I have several apps, each of which contains 100+ master items which I'm now trying to document...

       

      I COULD manually re-type / copy & paste the title and description of each one... but I'd rather not do that if possible.

       

      SO... I've created a small app in C# which connects to the app and uses the AppExtensions.GetDimensionList method to do the hard work... and so far, it seems to be working great.

       

      However, moving on to the other half of the issue... When I try the same for the Master Measures using AppExtensions.GetMeasureList, the titles are there, but the description seems to be missing... or at least hidden away somewhere.

       

      Can anyone shed some light on on where I can find my missing info pls...

       

      Cheers in advance,

       

      Mat

        • Re: Listing master items using .NET SDK
          Mat Smith

          So... I managed to get what I needed and figured I'd answer my own question in case someone else has the same problem.

           

          The Master Measure description is saved as Meta Data...

           

          Once you have the list of master measures (using AppExtensions.GetMeasureList(app)), you can loop through to get the relevant info for each one.  To get the meta data, use the below method:

                    item.Meta.Get<type>(meta data name)

           

          The below example uses a class I created called MasterItem which simply holds the Type (Dimension or Measure), Title and Description.

           

          List<MasterItem> mItems = new List<MasterItem>();

          var mList = AppExtensions.GetMeasureList(app);

           

          foreach (var item in mList.Items)

          {

              MasterItem m = new MasterItem();

              m.Type = "Measure";

              m.Title = item.Data.Title;

              m.Description = item.Meta.Get<string>("description");

           

              mItems.Add(m);

          }