Hi guys,
I'm currently using radgrid to show users these columns: tableName, dataSources, and dataTypes. And in the SQL database one unique dataName is attached to several dataSources/dataTypes. Currently what I can show in the table is 1 tableName and show the first dataSource attach to it in the SQL, and currently I need to show all the sources and types in a column (i.e. tableName: A, dataSource: B,C,D, dataType: E,F,G). Furthermore can I still use the sorting and filtering function for these columns?
Currently I'm using the code below (stored procedure in SQL) to obtain the dataSources by tableName. This will return dataSource1, dataSource2, and so on that is attached to the tableName. However I'm at lost on how to attach these dataSources in the column in radGrid. I searched around and I'm still not sure how to do it.
Thank you so much :)
I'm currently using radgrid to show users these columns: tableName, dataSources, and dataTypes. And in the SQL database one unique dataName is attached to several dataSources/dataTypes. Currently what I can show in the table is 1 tableName and show the first dataSource attach to it in the SQL, and currently I need to show all the sources and types in a column (i.e. tableName: A, dataSource: B,C,D, dataType: E,F,G). Furthermore can I still use the sorting and filtering function for these columns?
Currently I'm using the code below (stored procedure in SQL) to obtain the dataSources by tableName. This will return dataSource1, dataSource2, and so on that is attached to the tableName. However I'm at lost on how to attach these dataSources in the column in radGrid. I searched around and I'm still not sure how to do it.
USE [table]
GO
SET
ANSI_NULLS
ON
GO
SET
QUOTED_IDENTIFIER
ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER
PROCEDURE
[dbo].[getDataSources_byTableName]
-- Add the parameters for the stored procedure here
@tableName
varchar
(20)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET
NOCOUNT
ON
;
select
TableAttributeName,MetadataTableAttributes.TableAttributeId,
MetadataTableAttributeValues.TableAttributeValueId,
MetadataTableAttributeValues.TableAttributeValue
into
#tmp2
from
MetadataTableAttributeValues
inner
join
MetadataTableAttributes
on
MetadataTableAttributes.TableAttributeId = MetadataTableAttributeValues.TableAttributeId
select
distinct
MetadataTables.TableName,
#tmp2.*
into
#rpt2
from
MetadataTables
inner
join
MetadataTableAttributeValues
on
MetadataTables.TableId = MetadataTableAttributeValues.TableId
inner
join
#tmp2
on
MetadataTableAttributeValues.TableAttributeValueId = #tmp2.TableAttributeValueId
IF EXISTS (
SELECT
*
FROM
sys.objects
WHERE
object_id = OBJECT_ID(N
'[dbo].[caisis_tmp]'
)
AND
type
in
(N
'U'
))
DROP
TABLE
[dbo].[caisis_tmp]
CREATE
TABLE
[dbo].[caisis_tmp](
ptMRN [nvarchar](255),
dataSource1 [nvarchar](255),
dataSource2 [nvarchar](255),
dataSource3 [nvarchar](255),
dataSource4 [nvarchar](255),
)
ON
[
PRIMARY
]
INSERT
INTO
[caisis_tmp] (ptMRN)
select
distinct
TableName
from
#rpt2
update
[caisis_tmp]
set
[caisis_tmp].dataSource1=
(
SELECT
TOP
1 #rpt2.TableAttributeValue
from
#rpt2
where
[caisis_tmp].ptMRN = #rpt2.TableName);
update
[caisis_tmp]
set
[caisis_tmp].dataSource2=
(
SELECT
TABLEAttributeValue
from
(
SELECT
ROW_NUMBER() OVER (
ORDER
BY
TableAttributeValueID)
AS
RowNum, *
FROM
#rpt2
where
#rpt2.TableAttributeName=
'dataSource'
and
[caisis_tmp].ptMRN = #rpt2.tableName) sub
WHERE
RowNum = 2
)
update
[caisis_tmp]
set
[caisis_tmp].dataSource3=
(
SELECT
TABLEAttributeValue
from
(
SELECT
ROW_NUMBER() OVER (
ORDER
BY
TableAttributeValueID)
AS
RowNum, *
FROM
#rpt2
where
#rpt2.TableAttributeName=
'dataSource'
and
[caisis_tmp].ptMRN = #rpt2.tableName) sub
WHERE
RowNum = 3
)
update
[caisis_tmp]
set
[caisis_tmp].dataSource4=
(
SELECT
TABLEAttributeValue
from
(
SELECT
ROW_NUMBER() OVER (
ORDER
BY
TableAttributeValueID)
AS
RowNum, *
FROM
#rpt2
where
#rpt2.TableAttributeName=
'dataSource'
and
[caisis_tmp].ptMRN = #rpt2.tableName) sub
WHERE
RowNum = 4
)
select
*
from
[caisis_tmp]
where
ptMRN = @tableName
drop
table
[caisis_tmp],#tmp2,#rpt2
END
Thank you so much :)