This is a migrated thread and some comments may be shown as answers.

Object Reference error on using Query Designer

7 Answers 163 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
P
Top achievements
Rank 1
P asked on 23 Mar 2020, 08:56 AM

Hi,

I am using the Query Designer in the SQL DataSource component in my report. In the Database view section I can see the view I need and its columns but when I select one of them I get the error Object reference not set to an instance of an object. 

 

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Reporting.Design.QueryDesigner.Form.DataModelManager.CreateEntity(String path)
   at Telerik.Reporting.Design.QueryDesigner.Form.DataModelManager.FindOrCreateEntity(String path, Boolean refreshRelations)
   at Telerik.Reporting.Design.QueryDesigner.Form.DataModelManager.AddProperty(Property sourceProperty)
   at Telerik.Reporting.Design.QueryDesigner.Form.DataModelTreeViewController.TreeViewAfterCheck(Object sender, TreeViewEventArgs e)
   at System.Windows.Forms.TreeView.OnAfterCheck(TreeViewEventArgs e)
   at System.Windows.Forms.TreeView.WndProc(Message& m)
   at Telerik.Reporting.Design.Common.Controls.TreeViewEx.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

The same error is attached as a screenshot. When I click Continue, the column is not added to the Selected fields section. 

I am using other views for other SQL Data Source components and I have no problem with them. 

The only difference I can see with this view is that its query contains pivot statements. 

How can I resolve this issue?

 

Best Regards

 

7 Answers, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 26 Mar 2020, 07:28 AM

Hi,

This is not a known issue and we would need some additional information in order to reproduce it locally. Could you specify what type of database you are trying to connect to and what data provider you are using?

 

Regards,
Katia
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
P
Top achievements
Rank 1
answered on 26 Mar 2020, 08:22 AM

Hello,

I am using:

SQL Server 2016
SqlClient Data Provider
Telerik ReportDesigner R2 2019 TRIAL

My suggestion that the error had to do with the pivot statements in the specific database view turned out wrong. I successfully used in Query Builder other identical views which use pivot statements in the same way.

Still, for some views I always get this error, for others - never.  

Let me know in case you need further information,

Best Regards

0
Katia
Telerik team
answered on 31 Mar 2020, 05:47 AM

Hello,

It seems that the issue is reproducible using a specific query with pivot statements. Could you give an example of a query so we can test it on our side?

 

Regards,
Katia
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
P
Top achievements
Rank 1
answered on 10 Apr 2020, 01:08 PM

Hi again,

I managed to isolate a scenario with three example tables in a test database with which I can reproduce the error.

However this site does not allow me to attach neither the sql script which creates the tables, nor a txt file. How can I send it to you?

Best Regards

0
P
Top achievements
Rank 1
answered on 10 Apr 2020, 01:14 PM

 

 

 

 

I will try to paste it here, hope its length does not exceed any limitations:

------------------------

create schema N
go
create schema Registers
go

CREATE TABLE [N].[RegisterTypes](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](100) NOT NULL,
[NameEn] [nvarchar](100) NULL,
[Deactivated] [bit] NOT NULL,
 CONSTRAINT [PK_RegisterTypes] PRIMARY KEY CLUSTERED 
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [AK_RegisterTypes_Name] UNIQUE NONCLUSTERED 
(
[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [N].[RegisterTypes] ADD  DEFAULT ((0)) FOR [Deactivated]
GO

CREATE TABLE [dbo].[Registers](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](100) NOT NULL,
[NameEn] [nvarchar](100) NULL,
[Deactivated] [bit] NOT NULL,
[RegisterTypeId] [int] NULL,
[DetailsViewName] [nvarchar](250) NULL,
[NormalizedName] [nvarchar](100) NOT NULL,
[Deleted] [bit] NOT NULL,
 CONSTRAINT [PK_Registers] PRIMARY KEY CLUSTERED 
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [AK_Registers_Name] UNIQUE NONCLUSTERED 
(
[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Registers] ADD  DEFAULT ((0)) FOR [Deactivated]
GO
ALTER TABLE [dbo].[Registers] ADD  DEFAULT ('') FOR [NormalizedName]
GO
ALTER TABLE [dbo].[Registers] ADD  DEFAULT ((0)) FOR [Deleted]
GO
ALTER TABLE [dbo].[Registers]  WITH CHECK ADD  CONSTRAINT [FK_Registes_RegisterTypes] FOREIGN KEY([RegisterTypeId])
REFERENCES [N].[RegisterTypes] ([Id])
GO
ALTER TABLE [dbo].[Registers] CHECK CONSTRAINT [FK_Registes_RegisterTypes]
GO

CREATE TABLE [Registers].[AccommodationPlace](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](400) NOT NULL,
[NameEn] [nvarchar](400) NULL,
[TypeId] [int] NULL,
[CategoryId] [int] NULL,
[AddressId] [bigint] NULL,
[ContactId] [int] NULL,
[Url] [nvarchar](400) NULL,
[MenuTypeId] [int] NULL,
[Deactivated] [bit] NOT NULL,
[Description] [nvarchar](max) NULL,
[Other1] [nvarchar](max) NULL,
[Other2] [nvarchar](max) NULL,
[Single] [numeric](8, 2) NULL,
[Double] [numeric](8, 2) NULL,
[Triple] [numeric](8, 2) NULL,
[Apartment] [numeric](8, 2) NULL,
[Food] [bit] NULL,
[Deleted] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [AK_AccomodationPlace_Name] UNIQUE NONCLUSTERED 
(
[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [Registers].[AccommodationPlace] ADD  DEFAULT ((0)) FOR [Deactivated]
GO
ALTER TABLE [Registers].[AccommodationPlace] ADD  DEFAULT ((0)) FOR [Deleted]
GO
-----------------

0
Accepted
Todor
Telerik team
answered on 15 Apr 2020, 08:20 AM

Hi,

Thank you for the SQL Script. I executed it and managed to reproduce the issue with the created tables.

I have logged the issues on your behalf as a bug in our public feedback portal - Query Builder fails to create correctly the schema model. Your Telerik points have also been updated as a token of gratitude. You will receive an automatic update when the bug status changes.

Regards,
Todor
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
P
Top achievements
Rank 1
answered on 15 Apr 2020, 08:30 AM

Hi,

Thank you for the feedback. 

Best Regards

Tags
Report Designer (standalone)
Asked by
P
Top achievements
Rank 1
Answers by
Katia
Telerik team
P
Top achievements
Rank 1
Todor
Telerik team
Share this question
or