2 Replies Latest reply: Jan 23, 2015 11:30 AM by Shane Porter RSS

    .NET SDK No data returned for dynamic table

      Hi.

       

      I've attached a qvf - a really simple qvf, with two fields, country and population.

       

      In a .NET project, I'm attempting to get data from the qvf using the following code:

       

                  ILocation location = Location.Local;
                  IAppIdentifier identifier = location.AppWithName("CountryPop.qvf");
                  ISession session = Session.WithApp(identifier, SessionType.Random);
                  IApp app = location.App(identifier, session, true);
      
      
                  var sheet = app.GetSheet("BBfHGE");
                  const string tableId = "ThisIsATable";
      
                  var props = new TableProperties
                  {
                      Title = tableId,
                      HyperCubeDef = new TableHyperCubeDef
                      {
                          Dimensions = new[]
                          {
                              new HyperCubeDimensionDef
                              {
                                  LibraryId = "Country",
                              }
                          },
                      }
                  };
      
      
                  sheet.CreateTable(tableId, props);
      
      
                  ITable table = sheet.GetTable(tableId);
                  var data = table.GetData(new[] { new NxPage { Height = 100, Left = 0, Top = 0, Width = 1 } });
      

       

      When I look at 'data', it doesn't have any, well... data (despite my optimistic variable name )

       

      Not entirely sure why that is... if anybody can help me, it would be much appreciated!

       

      Thanks,

      Shane.

        • Re: .NET SDK No data returned for dynamic table
          prabhu appu

          Hi Shane,


          You have wrongly mentioned the LibraryId of the Dimension. It is not the name of the dimension. It is something unique for each dimension.


          To identify the Dimension ID simply use the below code and use it while creating the table.


           

          var dim_List = app.GetDimensionList();
          var id = dimm.Items.ToArray()[0].Info.Id;
          
          
          var props = new TableProperties
                      {
                          Title = tableId,
                          HyperCubeDef = new TableHyperCubeDef
                          {
                              Dimensions = new[]  
                              {  
                                  new HyperCubeDimensionDef  
                                  {  
                                      LibraryId = id,  
                                  }  
                              },
                          }
                      };
          

           

           

          Capture.PNG

          Regards,

          Prabhu Appu