Advertisement
Ruslan_Rayanov

Chart Pie

Oct 18th, 2020
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 1.33 KB | None | 0 0
  1. CREATE PROCEDURE [dbo].[crud_tst-chart4_getItems]
  2.     @filters CRUDFilterParameter READONLY,  
  3.     @sort sql_variant,
  4.     @direction nvarchar(8),
  5.     @page int,
  6.     @pageSize int,
  7.     @username nvarchar(32),
  8.     @parameters ExtendedDictionaryParameter readonly
  9.    
  10. AS
  11. BEGIN
  12. declare @langID int
  13.     select @langID = try_cast(Value as int) from @filters where [Key] = 'langID'
  14.  
  15.     declare @result TABLE (title nvarchar(256), value float, color nvarchar(64) )
  16.  
  17.     insert into @result
  18.     select 'Smartwatch' Title, 104 Value, 'pink' Color
  19.     union
  20.     select 'Videocard' Title, 102 Value, 'powderBlue' Color
  21.     union
  22.     select 'Kyboard' Title, 91 Value, 'lightGreen' Color
  23.     union
  24.     select 'Transmitter' Title, 70 Value, 'aqua' Color
  25.     union
  26.     select 'Voice recorder' Title, 24 Value, 'lightGrey' Color
  27.        
  28.     -- 1 SELECT - сами данные    
  29.     select * from @result
  30.     order by Value
  31.  
  32.     -- 2 SELECT - кол-во в таблице
  33.     select count(*) from @result   
  34.  
  35.     -- 3 SELECT Дополнительные настройки таблицы
  36.     select 'chart' ViewType, 'pie' ChartType, iif(@langID=1, 'By quantity sold', 'По количеству проданного') ChartTitle, 0 ChartWidth, 0 ChartHeight, 1 HidetitleCount,
  37.     iif(@langID=1, 'Top 5 Popular Products (2)', 'Топ 5 популярных продуктов (2)') Title
  38. END
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement