Advertisement
hecrus

Chart Radar

Oct 18th, 2020
2,455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 1.92 KB | None | 0 0
  1. CREATE PROCEDURE [dbo].[crud_tst-chart5_getItems]
  2.     @filters CRUDFilterParameter READONLY,  
  3.     @sort sql_variant,
  4.     @direction nvarchar(8),
  5.     @page int,
  6.     @pageSize int,
  7.     @username nvarchar(32)
  8. AS
  9. BEGIN
  10.     declare @langID int
  11.     select @langID = try_cast(Value as int) from @filters where [Key] = 'langID'
  12.  
  13.     declare @result TABLE (title nvarchar(256), value int, color nvarchar(128))
  14.  
  15.     declare @mon int
  16.     select @mon = Value from @filters where [Key] = 'mon'
  17.  
  18.     if @mon = 1
  19.         insert into @result
  20.         select '01' title, 5 Value, 'pink' color
  21.         union
  22.         select '05' title, 7 Value, 'powderBlue' color
  23.         union
  24.         select '10' title, 15 Value, 'lightGreen' color
  25.         union
  26.         select '15' title, 12 Value, 'cyan' color
  27.         union
  28.         select '20' title, 18 Value, 'aqua' color
  29.         union
  30.         select '25' title, 16 Value, 'purple' color
  31.         union
  32.         select '31' title, 15 Value, 'gold' color
  33.     else
  34.         insert into @result
  35.         select '01' title, 15 Value, 'pink' color
  36.         union
  37.         select '05' title, 19 Value, 'powderBlue' color
  38.         union
  39.         select '10' title, 21 Value, 'lightGreen' color
  40.         union
  41.         select '15' title, 17 Value, 'cyan' color
  42.         union
  43.         select '20' title, 14 Value, 'aqua' color
  44.         union
  45.         select '25' title, 18 Value, 'purple' color
  46.         union
  47.         select '31' title, 20 Value, 'gold' color
  48.        
  49.     -- 1 SELECT - сами данные    
  50.     select * from @result
  51.     order by title
  52.  
  53.     -- 2 SELECT - кол-во в таблице
  54.     select count(*) from @result   
  55.  
  56.     -- 3 SELECT Дополнительные настройки таблицы
  57.     select 'chart' ViewType, 'radar' ChartType, case when @mon = 1 then iif(@langID=1, 'March 2020', 'Март 2020') else iif(@langID=1,'April 2020', 'Апрель 2020') end ChartTitle,
  58.         0 ChartWidth, 0 ChartHeight, 1 HidetitleCount, 1 InstantFilter,
  59.         iif(@langID=1, 'Income statistics', 'Статистика дохода (тыс. руб.)') Title
  60. END
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement