Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

.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.

1 Solution

Accepted Solutions
prabhuappu
Creator II
Creator II

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

View solution in original post

2 Replies
prabhuappu
Creator II
Creator II

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

Not applicable
Author

Hi Prabhu,

that's great - thanks very much for your help!

I wrote the following code, since I need to use it more than once:

var dim = dimensionList.Items.FirstOrDefault(d => d.Data.Title == "Country");

string dimId = null;

if (dim != null)

{

    dimId = dim.Info.Id;

}

Thanks for pointing me in the right direction!