USP_DATALIST_KPIPARAMETERS
Displays the parameters defined for the given KPI.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@KPIID | uniqueidentifier | IN | Input parameter indicating the context ID for the data list. |
Definition
Copy
CREATE procedure dbo.USP_DATALIST_KPIPARAMETERS
(
@KPIID uniqueidentifier
)
as
set nocount on;
with xmlnamespaces ('bb_appfx_kpi' as tns, 'bb_appfx_commontypes' as common)
select
kpi.fields.value('@FieldID', 'nvarchar(max)') as FIELDID,
kpi.fields.value('@Caption', 'nvarchar(max)') as CAPTION,
coalesce(kpi.fields.value('@DataType', 'nvarchar(18)'), 'String') as DATATYPE,
case
when kpi.fields.exist('common:CodeTable') = 1 then
'Code Table ('
+ (select CODETABLENAME from dbo.CODETABLECATALOG where DBTABLENAME = kpi.fields.value('(common:CodeTable/@CodeTableName)[1]', 'nvarchar(100)'))
+ ')'
when kpi.fields.exist('common:ValueList') = 1 then 'Value List'
when kpi.fields.exist('common:SimpleDataList') = 1 then
'Simple Data List ('
+ (select NAME from dbo.SIMPLEDATALISTCATALOG where ID = kpi.fields.value('(common:SimpleDataList/@SimpleDataListID)[1]', 'nvarchar(60)'))
+ ')'
when kpi.fields.exist('common:Collection') = 1 then 'Collection'
when kpi.fields.exist('common:SearchList') = 1 then
'Search List ('
+ (select NAME from dbo.SEARCHLISTCATALOG where ID = kpi.fields.value('(common:SearchList/@SearchListID)[1]', 'nvarchar(60)'))
+ ')'
when kpi.fields.exist('common:Link') = 1 then 'Link'
when kpi.fields.exist('common:File') = 1 then 'File'
when kpi.fields.exist('common:CreditCard') = 1 then 'Credit Card'
when kpi.fields.exist('common:Html') = 1 then 'Html'
else ''
end as DESCRIPTOR,
case
when kpi.fields.exist('common:CodeTable') = 1 then 1
when kpi.fields.exist('common:ValueList') = 1 then 2
when kpi.fields.exist('common:SimpleDataList') = 1 then 3
when kpi.fields.exist('common:Collection') = 1 then 4
when kpi.fields.exist('common:SearchList') = 1 then 5
when kpi.fields.exist('common:Link') = 1 then 6
when kpi.fields.exist('common:File') = 1 then 7
when kpi.fields.exist('common:CreditCard') = 1 then 8
when kpi.fields.exist('common:Html') = 1 then 9
else 0
end as DESCRIPTORTYPE,
case
when kpi.fields.exist('common:CodeTable') = 1 then
(select ID from dbo.CODETABLECATALOG where DBTABLENAME = kpi.fields.value('(common:CodeTable/@CodeTableName)[1]', 'nvarchar(100)'))
when kpi.fields.exist('common:ValueList') = 1 then null
when kpi.fields.exist('common:SimpleDataList') = 1 then
kpi.fields.value('(common:SimpleDataList/@SimpleDataListID)[1]', 'uniqueidentifier')
when kpi.fields.exist('common:Collection') = 1 then null
when kpi.fields.exist('common:SearchList') = 1 then
kpi.fields.value('(common:SearchList/@SearchListID)[1]', 'uniqueidentifier')
when kpi.fields.exist('common:Link') = 1 then null
when kpi.fields.exist('common:File') = 1 then null
when kpi.fields.exist('common:CreditCard') = 1 then null
when kpi.fields.exist('common:Html') = 1 then null
else null
end as DESCRIPTORID,
coalesce(kpi.fields.value('@Hidden', 'bit'), 0) as HIDDEN,
coalesce(kpi.fields.value('@Required', 'bit'), 0) as REQUIRED,
coalesce(kpi.fields.value('@ReadOnly', 'bit'), 0) as READONLY,
dbo.UFN_INSTALLEDPRODUCTS_TRANSLATELIST(kpi.fields.query('common:InstalledProductList')) as INSTALLEDPRODUCTSLIST,
dbo.UFN_INSTALLEDPRODUCTS_OPTIONALPRODUCTSINSTALLED(kpi.fields.query('common:InstalledProductList')) as INSTALLED
from dbo.KPICATALOG as K
cross apply K.SPECXML.nodes('tns:KpiSpec/tns:KpiFormDefinition/common:FormMetaData/common:FormFields/common:FormField') as kpi(fields)
where K.ID = @KPIID