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
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
Our thoughts here at Progress are with those affected by the outbreak.
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
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
Our thoughts here at Progress are with those affected by the outbreak.
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
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
-----------------
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
Our thoughts here at Progress are with those affected by the outbreak.
Hi,
Thank you for the feedback.
Best Regards