Hi guys:
I have created a RadGrid to connect to an OLAP datasource. That grid has three columns bounded to the following column names returned from that datasource:
[Periodo].[Periodo].[Mes].[MEMBER_CAPTION]
[Tipo Afiliado].[TipoAfiliado].[Tipo Afiliado].[MEMBER_CAPTION]
[Measures].[Total trabajadores afiliados]
When i want to click over one of the columns in the grid, i receive the following error:
Sys.WebForms.PageRequestManagerServerErrorException: Cannot find column Periodo].[Periodo].[Mes].[MEMBER_CAPTION.
Note that in the error description the column name given lacks the "[" character at the begining and the "]" character at the end.
If i configure the RadGrid to query a SQL Server database, the ordering works fine. I only have troubles with OLAP datasources.
I have created a RadGrid to connect to an OLAP datasource. That grid has three columns bounded to the following column names returned from that datasource:
[Periodo].[Periodo].[Mes].[MEMBER_CAPTION]
[Tipo Afiliado].[TipoAfiliado].[Tipo Afiliado].[MEMBER_CAPTION]
[Measures].[Total trabajadores afiliados]
When i want to click over one of the columns in the grid, i receive the following error:
Sys.WebForms.PageRequestManagerServerErrorException: Cannot find column Periodo].[Periodo].[Mes].[MEMBER_CAPTION.
Note that in the error description the column name given lacks the "[" character at the begining and the "]" character at the end.
If i configure the RadGrid to query a SQL Server database, the ordering works fine. I only have troubles with OLAP datasources.
5 Answers, 1 is accepted
0
Hi Wveimar,
Can you verify if your scenario works normally with standard MS GridView control and let us know about the result?
Regards,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Can you verify if your scenario works normally with standard MS GridView control and let us know about the result?
Regards,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Wveimar
Top achievements
Rank 1
answered on 08 Sep 2009, 04:07 PM
Hi Vlad:
I build a sample using the GridView control and i get the same base error:
Exception Details: System.IndexOutOfRangeException: Cannot find column Measures].[Total trabajadores afiliados.
¿What do you suggest to solve this issue?
Thanks in advance.
I build a sample using the GridView control and i get the same base error:
Cannot find column Measures].[Total trabajadores afiliados.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.IndexOutOfRangeException: Cannot find column Measures].[Total trabajadores afiliados.
¿What do you suggest to solve this issue?
Thanks in advance.
0
Wveimar
Top achievements
Rank 1
answered on 08 Sep 2009, 04:51 PM
I used a workaround to solve the problem. I simply replace the characters "[", "]" with underscores "_" in the column names given by the datasource. Now the sorting is working fine with alphabetic columns, but no with numeric ones. It keeps giving me the same error:
Sys.WebForms.PageRequestManagerServerErrorException: Cannot find column Measures_DiferenciaTrabajador
0
Wveimar
Top achievements
Rank 1
answered on 09 Sep 2009, 03:29 PM
Perseverance gives me te solution. Before explaining the way i solve
this issue, i will try to explain the details of its cause. If you
need to populate a RadGrid with data that comes from a OLAP DataSource,
you have two choices:
1. You can use a CellSet object populated with the results of a MDX query, dig into its complex structure, and make the databinding tasks required to show data over RadGrid.
2. You can use an AdomdDataAdapter that allows you to execute the MDX query and receive a more human data object (DataSet). With the DataSet in your hands, it is more easy to do the databinding.
In my case, i used the second option ¿Why? Because the solution arquitecture indicates that all the data must be transported over DataSet objects, due to funcional requeriments that gives the possibility of a future system extensión that may include new data sources.
The problem that arises when you use the AdomdDataAdapter is the following. All the numeric datacolumns returned by that object, are automatically given a System.Object datatype. With that datatype, the sorting in the RadGrid doesn't works. ¿Why? I don't really know. The workaround to solve this issue is change the datatype to something more precise, for example, System.Decimal.
This is a code snippet that show the solution:
The FixData method receives the DataSet object given by the AdomdDataAdapter. Note that we also replace some characters in the column names. This is also required so sorting works fine. Then, we transpose the data to a new DataSet. This is required because once a table contains data, its column data types cannot be changed. In the tranposing process, we change the column data type to those columns whose data type is System.Object.
1. You can use a CellSet object populated with the results of a MDX query, dig into its complex structure, and make the databinding tasks required to show data over RadGrid.
2. You can use an AdomdDataAdapter that allows you to execute the MDX query and receive a more human data object (DataSet). With the DataSet in your hands, it is more easy to do the databinding.
In my case, i used the second option ¿Why? Because the solution arquitecture indicates that all the data must be transported over DataSet objects, due to funcional requeriments that gives the possibility of a future system extensión that may include new data sources.
The problem that arises when you use the AdomdDataAdapter is the following. All the numeric datacolumns returned by that object, are automatically given a System.Object datatype. With that datatype, the sorting in the RadGrid doesn't works. ¿Why? I don't really know. The workaround to solve this issue is change the datatype to something more precise, for example, System.Decimal.
This is a code snippet that show the solution:
| private DataSet FixData(DataSet dataSet) |
| { |
| foreach (DataColumn col in dataSet.Tables[0].Columns) |
| { |
| col.ColumnName = col.ColumnName.Replace("].[", "_"); |
| col.ColumnName = col.ColumnName.Replace("[", ""); |
| col.ColumnName = col.ColumnName.Replace("]", ""); |
| col.ColumnName = col.ColumnName.Replace(" ", "_"); |
| } |
| DataSet dsNew = new DataSet(); |
| dsNew.Tables.Add(new DataTable("OLAPData")); |
| foreach (DataColumn col in dataSet.Tables[0].Columns) |
| { |
| DataColumn newCol = new DataColumn(); |
| newCol.ColumnName = col.ColumnName; |
| if (col.DataType == typeof(object)) |
| newCol.DataType = typeof(decimal); |
| else |
| newCol.DataType = col.DataType; |
| dsNew.Tables[0].Columns.Add(newCol); |
| } |
| foreach (DataRow row in dataSet.Tables[0].Rows) |
| { |
| dsNew.Tables[0].Rows.Add(row.ItemArray); |
| } |
| return dsNew; |
| } |
The FixData method receives the DataSet object given by the AdomdDataAdapter. Note that we also replace some characters in the column names. This is also required so sorting works fine. Then, we transpose the data to a new DataSet. This is required because once a table contains data, its column data types cannot be changed. In the tranposing process, we change the column data type to those columns whose data type is System.Object.
0
Hello Wveimar,
Thank you very much for sharing your solution in this public forum thread! Thus other community members who would like to bind RadGrid for ASP.NET AJAX to OLAP DataSource will be able to try it out. We really appreciate your involvement here and updated your Telerik points as a token of gratitude (they can be used as a discount for future upgrades/purchases of our controls).
Best regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Thank you very much for sharing your solution in this public forum thread! Thus other community members who would like to bind RadGrid for ASP.NET AJAX to OLAP DataSource will be able to try it out. We really appreciate your involvement here and updated your Telerik points as a token of gratitude (they can be used as a discount for future upgrades/purchases of our controls).
Best regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
